Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7badd01

Browse files
committed
add tests for early exit when attributes are missing
1 parent f93ec0b commit 7badd01

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ describe('auto-check element', function() {
5151
assert.isFalse(input.checkValidity())
5252
})
5353

54+
it('validates the input element if there is no `src` attribute', async function() {
55+
checker.removeAttribute('src')
56+
const completeEvent = once(checker, 'auto-check-complete')
57+
triggerChange(input, 'hub')
58+
await completeEvent
59+
assert.isTrue(input.checkValidity())
60+
checker.src = '/success'
61+
})
62+
63+
it('validates the input element if there is no `csrf` attribute', async function() {
64+
checker.removeAttribute('csrf')
65+
const completeEvent = once(checker, 'auto-check-complete')
66+
triggerChange(input, 'hub')
67+
await completeEvent
68+
assert.isTrue(input.checkValidity())
69+
checker.csrf = 'foo'
70+
})
71+
5472
it('invalidates input request is in-flight', async function() {
5573
triggerChange(input, 'hub')
5674
await once(checker, 'loadstart')

0 commit comments

Comments
 (0)