From 43b007f9902ac196746144efa04f4b58a495ea9e Mon Sep 17 00:00:00 2001 From: Chris Dumez Date: Wed, 10 Oct 2018 09:52:57 -0700 Subject: [PATCH] Update test for 'noopener' feature of window.open Update test for 'noopener' feature of window.open to reflect the changes made in https://github.com/whatwg/html/pull/4079. --- .../open-features-tokenization-noopener.html | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html b/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html index cac23648ade4c1..c31e75fdf57e1d 100644 --- a/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html +++ b/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noopener.html @@ -40,8 +40,10 @@ 'noOpenER', ' NOopener', '=NOOPENER', - 'noopener=NOOPENER', // => ('noopener', 'noopener') - 'NOOPENER=noopener' // => ('noopener', 'noopener') + 'noopener=1', + 'NOOPENER=1', + 'NOOPENER=yes', + 'noopener=YES', ]; featureVariants.forEach(feature => { var win = window.open(windowURL, '', feature); @@ -82,9 +84,9 @@ 'noopener==,', 'noopener=\n ,', 'noopener = \t ,', - 'noopener\n=\r noopener,', // => ('noopener', 'noopener') + 'noopener\n=\r 1,', // => ('noopener', '1') 'noopener=,yes', // => ('noopener'), ('yes') - 'noopener= foo=,', // => ('noopener', 'foo') + 'noopener= yes=,', // => ('noopener', 'yes') 'noopener = \u000Cyes' // => ('noopener', 'yes') ]; featureVariants.forEach(feature => { @@ -96,14 +98,14 @@ test (t => { // Tokenizing `value` should collect any non-separator code points until first separator var featureVariants = [ - 'noopener=noopener', // => ('noopener', 'noopener') + 'noopener=1', // => ('noopener', 'noopener') 'noopener=yes', // => ('noopener', 'yes') 'noopener = yes ,', // => ('noopener', 'yes') 'noopener=\nyes ,', // => ('noopener', 'yes') 'noopener=yes yes', // => ('noopener', 'yes'), ('yes', '') 'noopener=yes\ts', // => ('noopener', 'yes'), ('s', '') 'noopener==', // => ('noopener', '') - 'noopener=0\n,', // => ('noopener', '0') + 'noopener=1\n,', // => ('noopener', '1') '==noopener===', // => ('noopener', '') 'noopener==\u000C' // => ('noopener', '') ]; @@ -114,20 +116,30 @@ }, 'Tokenizing should read characters until first window feature separator as `value`'); test (t => { - // If tokenizedFeatures contains an entry with the key "noopener"...disown opener - // i.e. `value` should be irrelevant var featureVariants = [ - 'noopener=false', - ',noopener=0, ', - 'foo=bar,noopener=noopener,', - 'noopener=true', - 'noopener=foo\nbar\t' + 'noopener=1', + 'noopener=2', + 'noopener=12345', + 'noopener=1.5', + 'noopener=-1', ]; featureVariants.forEach(feature => { var win = window.open(windowURL, '', feature); assert_equals(win, null, `"${feature}" should activate feature "noopener"`); }); -}, '"noopener" should be based on name (key), not value'); +}, 'Integer values other than 0 should activate the feature'); + +test (t => { + var featureVariants = [ + 'noopener=0', + 'noopener=0.5', + 'noopener=error', + ]; + featureVariants.forEach(feature => { + var win = window.open(windowURL, '', feature); + assert_not_equals(win, null, `"${feature}" should NOT activate feature "noopener"`); + }); +}, 'Integer value of 0 should not activate the feature'); test (t => { var invalidFeatureVariants = [