expect(tooltipShown).toBeDefined()
expect(tooltipEl.getAttribute('aria-describedby')).toEqual(tooltipShown.getAttribute('id'))
- expect(tooltipShown.getAttribute('id').indexOf('tooltip') !== -1).toEqual(true)
+ expect(tooltipShown.getAttribute('id')).toContain('tooltip')
done()
})
const result = sanitizeHtml(template, DefaultAllowlist, null)
- expect(result.indexOf('script') === -1).toEqual(true)
+ expect(result).not.toContain('script')
})
it('should allow aria attributes and safe attributes', () => {
const result = sanitizeHtml(template, DefaultAllowlist, null)
- expect(result.indexOf('aria-pressed') !== -1).toEqual(true)
- expect(result.indexOf('class="test"') !== -1).toEqual(true)
+ expect(result).toContain('aria-pressed')
+ expect(result).toContain('class="test"')
})
it('should remove tags not in allowlist', () => {
const result = sanitizeHtml(template, DefaultAllowlist, null)
- expect(result.indexOf('<script>') === -1).toEqual(true)
+ expect(result).not.toContain('<script>')
})
it('should not use native api to sanitize if a custom function passed', () => {