Skip to content

Commit ce04a96

Browse files
author
Caroline Green
committed
Add end to end tests for disable hint option
1 parent a10ec71 commit ce04a96

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test/integration/index.js

+49
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,53 @@ const customTemplatesExample = () => {
124124
})
125125
}
126126

127+
const autoselectExample = () => {
128+
describe('autoselect example', function () {
129+
this.retries(3)
130+
131+
const input = 'input#autocomplete-autoselect'
132+
const menu = `${input} + ul`
133+
const wrapper = '#tt-autoselect'
134+
const hint = `${wrapper} .autocomplete__hint`
135+
136+
beforeEach(() => {
137+
browser.setValue(input, '') // Prevent autofilling, IE likes to do this.
138+
})
139+
140+
it('should display hint', () => {
141+
browser.click(input)
142+
browser.setValue(input, 'ita')
143+
browser.waitForVisible(menu)
144+
expect(browser.isVisible(menu)).to.equal(true)
145+
expect(browser.isVisible(hint)).to.equal(true)
146+
expect(browser.getValue(hint)).to.equal('italy')
147+
})
148+
})
149+
}
150+
151+
const doNotDisplayHintExample = () => {
152+
describe('doNotDisplayHintExample example', function () {
153+
this.retries(3)
154+
155+
const input = 'input#autocomplete-autoselect'
156+
const menu = `${input} + ul`
157+
const wrapper = '#tt-tt-noHint'
158+
const hint = `${wrapper} .autocomplete__hint`
159+
160+
beforeEach(() => {
161+
browser.setValue(input, '') // Prevent autofilling, IE likes to do this.
162+
})
163+
164+
it('should not display hint', () => {
165+
browser.click(input)
166+
browser.setValue(input, 'ita')
167+
browser.waitForVisible(menu)
168+
expect(browser.isVisible(menu)).to.equal(true)
169+
expect(browser.isVisible(hint)).to.equal(false)
170+
})
171+
})
172+
}
173+
127174
const takeScreenshotsIfFail = () => {
128175
afterEach(function () {
129176
const testFailed = this.currentTest.state === 'failed'
@@ -149,6 +196,8 @@ describe('Accessible Autocomplete', () => {
149196

150197
basicExample()
151198
customTemplatesExample()
199+
autoselectExample()
200+
doNotDisplayHintExample()
152201

153202
takeScreenshotsIfFail()
154203
})

0 commit comments

Comments
 (0)