mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
tests: switch to using toContain()
to check for substring presence (#32043)
This commit is contained in:
parent
e0b8fcdf89
commit
71010cb1e9
@ -317,7 +317,7 @@ describe('Tooltip', () => {
|
||||
|
||||
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()
|
||||
})
|
||||
|
||||
|
@ -20,7 +20,7 @@ describe('Sanitizer', () => {
|
||||
|
||||
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', () => {
|
||||
@ -32,8 +32,8 @@ describe('Sanitizer', () => {
|
||||
|
||||
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', () => {
|
||||
@ -45,7 +45,7 @@ describe('Sanitizer', () => {
|
||||
|
||||
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', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user