Skip to content

Commit

Permalink
Bug 1497987 [wpt PR 13458] - Update test for 'noopener' feature of wi…
Browse files Browse the repository at this point in the history
…ndow.open, a=testonly

Automatic update from web-platform-testsUpdate test for 'noopener' feature of window.open

Update test for 'noopener' feature of window.open to reflect the changes made in
whatwg/html#4079.

--

wpt-commits: 56e5e93ef1ce1097a1b8749423b52e1fa180f6aa
wpt-pr: 13458

UltraBlame original commit: 6889ec30451700089a5ace06d3cd469a42e0b042
  • Loading branch information
marco-c committed Oct 3, 2019
1 parent 5efbe6e commit dbfc532
Showing 1 changed file with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 => {
Expand All @@ -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', '')
];
Expand All @@ -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 = [
Expand Down

0 comments on commit dbfc532

Please sign in to comment.