]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
tests: switch to using `toContain()` to check for substring presence (#32043)
authorXhmikosR <xhmikosr@gmail.com>
Mon, 2 Nov 2020 12:42:40 +0000 (14:42 +0200)
committerGitHub <noreply@github.com>
Mon, 2 Nov 2020 12:42:40 +0000 (14:42 +0200)
js/tests/unit/tooltip.spec.js
js/tests/unit/util/sanitizer.spec.js

index 3e5c9179401b77e41af3ae84fb501c613d61b142..611fadfe1c5bff855ce5a094e0b15ed920bc012c 100644 (file)
@@ -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()
       })
 
index dcfad8436f8fef0337b2698242b99c1558dc8be8..395875d62402ed28e7d24171401aa16379506525 100644 (file)
@@ -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', () => {