diff --git a/common/changes/office-ui-fabric-react/dropdown-title_2018-05-25-01-55.json b/common/changes/office-ui-fabric-react/dropdown-title_2018-05-25-01-55.json new file mode 100644 index 00000000000000..bc9cd32697ced7 --- /dev/null +++ b/common/changes/office-ui-fabric-react/dropdown-title_2018-05-25-01-55.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "Dropdown: Allow `title` to be provided as an item property.", + "type": "minor" + } + ], + "packageName": "office-ui-fabric-react", + "email": "dzearing@microsoft.com" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.test.tsx b/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.test.tsx index 8a7317ae4bb210..93c96c2e5f9ec4 100644 --- a/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.test.tsx +++ b/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.test.tsx @@ -15,7 +15,7 @@ import { DropdownMenuItemType, IDropdownOption } from './Dropdown.types'; const DEFAULT_OPTIONS: IDropdownOption[] = [ { key: 'Header1', text: 'Header 1', itemType: DropdownMenuItemType.Header }, { key: '1', text: '1' }, - { key: '2', text: '2' }, + { key: '2', text: '2', title: 'test' }, { key: '3', text: '3' }, { key: 'Divider1', text: '-', itemType: DropdownMenuItemType.Divider }, { key: 'Header2', text: 'Header 2', itemType: DropdownMenuItemType.Header }, @@ -191,6 +191,9 @@ describe('Dropdown', () => { ReactTestUtils.Simulate.click(dropdownRoot); const secondItemElement = document.querySelector('.ms-Dropdown-item[data-index="2"]') as HTMLElement; + + expect(secondItemElement.getAttribute('title')).toEqual('test'); + ReactTestUtils.Simulate.click(secondItemElement); } finally { diff --git a/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.tsx b/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.tsx index 1747a460e1e8f3..a279f487b8cf8d 100644 --- a/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.tsx +++ b/packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.tsx @@ -510,6 +510,7 @@ export class Dropdown extends BaseComponent { onRenderOption(item, this._onRenderOption) } @@ -527,6 +528,7 @@ export class Dropdown extends BaseComponent