Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Dropdown-test): fix selection range test #729

Merged
merged 1 commit into from
Oct 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions test/specs/modules/Dropdown/Dropdown-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,28 +791,24 @@ describe('Dropdown Component', () => {
wrapper.simulate('click')
dropdownMenuIsOpen()

// activate the last item
// activate the last item, removing it from the list
domEvent.keyDown(document, { key: 'ArrowUp' })

wrapper
.should.have.exactly(options.length).descendants('DropdownItem')
wrapper
.find('DropdownItem')
.last()
.should.have.prop('selected', true)

domEvent.keyDown(document, { key: 'Enter' })

// expect selection to have moved from last, to one from last
// activating items in multiple selects removes them from the list
// we use at() to ensure we're targeting the exact indexes we expect
// (ie the last() item will vary)
// one item should be gone, and the _new_ last item should be selected
wrapper
.find('DropdownItem')
.at(options.length - 1)
.should.not.have.prop('selected', true)

.should.have.exactly(options.length - 1).descendants('DropdownItem')
wrapper
.find('DropdownItem')
.at(options.length - 2)
.last()
.should.have.prop('selected', true)
})
it('has labels with delete icons', () => {
Expand Down