Skip to content

Commit

Permalink
test: test case for hidden input with matching label
Browse files Browse the repository at this point in the history
  • Loading branch information
is2ei authored and nschonni committed Jan 27, 2022
1 parent cab2907 commit 37b0696
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/rules/input-requires-label.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ describe(`Rules: ${ruleId}`, () => {
const messages = HTMLHint.verify(code, ruleOptions)
expect(messages.length).to.be(0)
})

it('Hidden input tag with matching label before should result in no error', () => {
const code = '<label for="some-id"/><input id="some-id" type="hidden" />'
const messages = HTMLHint.verify(code, ruleOptions)
expect(messages.length).to.be(0)
})

it('Hidden input tag with matching label after should result in no error', () => {
const code = '<input id="some-id" type="hidden" /><label for="some-id"/>'
const messages = HTMLHint.verify(code, ruleOptions)
expect(messages.length).to.be(0)
})
})

describe('Error cases', () => {
Expand Down

0 comments on commit 37b0696

Please sign in to comment.