Add failing test for KapacitorRules renders both tables rows with unique label FORs

pull/3006/head
Jared Scheib 2018-03-16 16:04:04 -07:00
parent 4080c31e93
commit a1a40ddc01
1 changed files with 26 additions and 0 deletions

View File

@ -72,5 +72,31 @@ describe('Kapacitor.Containers.KapacitorRules', () => {
expect(containsAnyDuplicate(allCheckboxesIDs)).toEqual(false)
})
it('renders each rule/task table row label with unique "for" attribute', () => {
const {wrapper} = setup()
const kapacitorRulesTableRowsLabelFors = wrapper
.find('KapacitorRulesTable')
.dive()
.find('tbody')
.children()
.map(child => child.dive().find('label').props().htmlFor)
const tasksTableLabelFors = wrapper
.find('TasksTable')
.dive()
.find('tbody')
.children()
.map(child => child.dive().find('label').props().htmlFor)
const allCheckboxesLabelFors = kapacitorRulesTableRowsLabelFors.concat(
tasksTableLabelFors
)
const containsAnyDuplicate = arr => _.uniq(arr).length !== arr.length
expect(containsAnyDuplicate(allCheckboxesLabelFors)).toEqual(false)
})
})
})