Skip to content

Commit

Permalink
updates/fixes from the day
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcy Sutton committed Jul 30, 2019
1 parent 9ac66c5 commit d3869ff
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
24 changes: 21 additions & 3 deletions examples/unit-testing/dropdown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,28 @@ describe(`Dropdown`, () => {

expect(text).toBeInTheDocument()
})
it(`renders a focusable activator element`, () => {
it(`renders a focusable button that activates the dropdown`, () => {
const activatorText = `Dogs`
const items = [{
text: 'item 1',
url: '#'
}, {
text: 'item 2',
url: '#'
}]
const dropdown = render(<Dropdown activatorText={activatorText} items={items} />)

})
it(`sends focus to dropdown content when active`, () => {
const activator = dropdown.getByTestId('dropdown-activator')
activator.focus()

expect(activator).toHaveFocus()

fireEvent.click(activator)

const dropdownList = dropdown.getByTestId('dropdown-itemList')

const firstAnchor = dropdownList.querySelector('a')
expect(firstAnchor).toHaveFocus()

})
})
2 changes: 1 addition & 1 deletion src/components/site-chrome/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body {
a, a:link, a:visited {
color: #333;
}
.js-focus-visible :focus {
.js-focus-visible :focus:not(.focus-visible) {
outline: none;
}
.js-focus-visible :focus-visible {
Expand Down
1 change: 1 addition & 0 deletions src/slides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ http://bit.ly/microsoft-inclusive-toolkit
- Accessibility debugging
- Accessibility in JavaScript apps
- Focus management
- Client-side routing
- Announcements
- Semantic HTML
- Unobtrusive motion
Expand Down

0 comments on commit d3869ff

Please sign in to comment.