From 536c53c16cafcde3250e8d062aeb04c1590c1418 Mon Sep 17 00:00:00 2001 From: nlipka Date: Thu, 18 Feb 2021 11:37:20 +0100 Subject: add some space --- js/src/alert.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/src/alert.js b/js/src/alert.js index 3a018a638..8fc3f12a8 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -126,6 +126,7 @@ class Alert extends BaseComponent { * Data Api implementation * ------------------------------------------------------------------------ */ + EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())) /** -- cgit v1.2.3 From e8f08d1802976b8200551de49354757f84e438cf Mon Sep 17 00:00:00 2001 From: Nikon the Third Date: Fri, 19 Feb 2021 09:24:53 +0100 Subject: Adjust regex `SAFE_URL_PATTERN` for use with test method of regexes. (#33136) The test method on regexes behaves different than the match method on strings in the presence of the global modifier. Add a unit test for sanitizing the same template twice. Co-authored-by: XhmikosR --- js/src/util/sanitizer.js | 2 +- js/tests/unit/util/sanitizer.spec.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/src/util/sanitizer.js b/js/src/util/sanitizer.js index 18ac6f943..57653a891 100644 --- a/js/src/util/sanitizer.js +++ b/js/src/util/sanitizer.js @@ -23,7 +23,7 @@ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i * * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts */ -const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi +const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i /** * A pattern that matches safe data URLs. Only matches image, video and audio types. diff --git a/js/tests/unit/util/sanitizer.spec.js b/js/tests/unit/util/sanitizer.spec.js index 869b8c561..7379d221f 100644 --- a/js/tests/unit/util/sanitizer.spec.js +++ b/js/tests/unit/util/sanitizer.spec.js @@ -66,5 +66,15 @@ describe('Sanitizer', () => { expect(result).toEqual(template) expect(DOMParser.prototype.parseFromString).not.toHaveBeenCalled() }) + + it('should allow multiple sanitation passes of the same template', () => { + const template = '' + + const firstResult = sanitizeHtml(template, DefaultAllowlist, null) + const secondResult = sanitizeHtml(template, DefaultAllowlist, null) + + expect(firstResult).toContain('src') + expect(secondResult).toContain('src') + }) }) }) -- cgit v1.2.3 From 5693f1ad863832adb01ed1ca9cd24c825fc640f4 Mon Sep 17 00:00:00 2001 From: "Patrick H. Lauke" Date: Sun, 21 Feb 2021 06:00:03 +0000 Subject: Fix small typos / follow-up to #32630 (#33164) --- js/tests/unit/tab.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/tests/unit/tab.spec.js b/js/tests/unit/tab.spec.js index 463fb79af..c52812f52 100644 --- a/js/tests/unit/tab.spec.js +++ b/js/tests/unit/tab.spec.js @@ -160,7 +160,7 @@ describe('Tab', () => { fixtureEl.innerHTML = [ '', '
', '
', -- cgit v1.2.3 From 730566221f93a3feab5d33d4f19ed3d178feaa09 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 22 Feb 2021 08:42:43 +0200 Subject: visual tests: add missing base-component dist file (#33167) Regression of #32313 --- js/tests/visual/alert.html | 1 + js/tests/visual/button.html | 1 + js/tests/visual/carousel.html | 1 + js/tests/visual/collapse.html | 1 + js/tests/visual/dropdown.html | 1 + js/tests/visual/modal.html | 1 + js/tests/visual/popover.html | 1 + js/tests/visual/scrollspy.html | 1 + js/tests/visual/tab.html | 1 + js/tests/visual/toast.html | 1 + js/tests/visual/tooltip.html | 1 + 11 files changed, 11 insertions(+) (limited to 'js') diff --git a/js/tests/visual/alert.html b/js/tests/visual/alert.html index 07f9b972d..c5e2efafa 100644 --- a/js/tests/visual/alert.html +++ b/js/tests/visual/alert.html @@ -46,6 +46,7 @@ + diff --git a/js/tests/visual/button.html b/js/tests/visual/button.html index 75ad13209..0bd2f1097 100644 --- a/js/tests/visual/button.html +++ b/js/tests/visual/button.html @@ -47,6 +47,7 @@ + diff --git a/js/tests/visual/carousel.html b/js/tests/visual/carousel.html index 6b1618124..2a7f793f6 100644 --- a/js/tests/visual/carousel.html +++ b/js/tests/visual/carousel.html @@ -49,6 +49,7 @@ + + diff --git a/js/tests/visual/dropdown.html b/js/tests/visual/dropdown.html index 86d679c95..f1dd705f3 100644 --- a/js/tests/visual/dropdown.html +++ b/js/tests/visual/dropdown.html @@ -205,6 +205,7 @@ + diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index cb418622a..8ad9f63fb 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -204,6 +204,7 @@ + diff --git a/js/tests/visual/popover.html b/js/tests/visual/popover.html index ddc068708..986ac571e 100644 --- a/js/tests/visual/popover.html +++ b/js/tests/visual/popover.html @@ -36,6 +36,7 @@ + + diff --git a/js/tests/visual/tab.html b/js/tests/visual/tab.html index eeace6bbb..16c19de63 100644 --- a/js/tests/visual/tab.html +++ b/js/tests/visual/tab.html @@ -223,6 +223,7 @@ + diff --git a/js/tests/visual/toast.html b/js/tests/visual/toast.html index 4765026f3..3971a6075 100644 --- a/js/tests/visual/toast.html +++ b/js/tests/visual/toast.html @@ -53,6 +53,7 @@ + +