From: XhmikosR Date: Mon, 2 Nov 2020 12:42:40 +0000 (+0200) Subject: tests: switch to using `toContain()` to check for substring presence (#32043) X-Git-Tag: v5.0.0-alpha3~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71010cb1e99c95619e71f271e941e7edb0c6ea37;p=thirdparty%2Fbootstrap.git tests: switch to using `toContain()` to check for substring presence (#32043) --- diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js index 3e5c917940..611fadfe1c 100644 --- a/js/tests/unit/tooltip.spec.js +++ b/js/tests/unit/tooltip.spec.js @@ -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() }) diff --git a/js/tests/unit/util/sanitizer.spec.js b/js/tests/unit/util/sanitizer.spec.js index dcfad8436f..395875d624 100644 --- a/js/tests/unit/util/sanitizer.spec.js +++ b/js/tests/unit/util/sanitizer.spec.js @@ -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('