From f6d6a9f78da03a7236c269e6462461adf68a2cfe Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Sat, 1 Jul 2023 01:35:09 +0000 Subject: [PATCH] Bug 1838986 [wpt PR 40606] - Move CustomElementRegistry.getName() tests to a tentative test file, a=testonly Automatic update from web-platform-tests Move CustomElementRegistry.getName() tests to a tentative test file The spec change [1] hasn't landed yet, so the tests can only be tentative. This also prevents affecting interop2023 [2]. [1] https://github.com/whatwg/html/pull/9195 [2] https://github.com/web-platform-tests/interop/issues/358 Bug: 1435389 Change-Id: I1e35d7f06bcf2b005304cdc182a67cfa69b74de1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4621660 Auto-Submit: Xiaocheng Hu Reviewed-by: Mason Freed Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main{#1160209} -- wpt-commits: 99ee1f53f877610adf1f29399ea9660905e6d7a9 wpt-pr: 40606 UltraBlame original commit: ff55e5770af6e99f114c0593f02f296318fa584f --- ...stomElementRegistry-getName.tentative.html | 662 ++++++++++++++++++ .../CustomElementRegistry.html | 561 --------------- 2 files changed, 662 insertions(+), 561 deletions(-) create mode 100644 testing/web-platform/tests/custom-elements/CustomElementRegistry-getName.tentative.html diff --git a/testing/web-platform/tests/custom-elements/CustomElementRegistry-getName.tentative.html b/testing/web-platform/tests/custom-elements/CustomElementRegistry-getName.tentative.html new file mode 100644 index 000000000000..5753d2d1ed1d --- /dev/null +++ b/testing/web-platform/tests/custom-elements/CustomElementRegistry-getName.tentative.html @@ -0,0 +1,662 @@ +< +! +DOCTYPE +html +> +< +title +> +Custom +Elements +: +CustomElementRegistry +. +getName +function +< +/ +title +> +< +meta +name += +" +author +" +title += +" +Keith +Cirkel +" +href += +" +mailto +: +keithamus +github +. +com +" +> +< +meta +name += +" +assert +" +content += +" +CustomElementRegistry +. +getName +function +exists +" +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +script +> +test +( +function +( +) +{ +assert_equals +( +customElements +. +getName +( +class +extends +HTMLElement +{ +} +) +null +) +; +} +' +customElements +. +getName +must +return +null +when +the +registry +does +not +contain +an +entry +with +the +given +constructor +' +) +; +test +( +function +( +) +{ +assert_throws_js +( +TypeError +function +( +) +{ +customElements +. +getName +( +undefined +) +; +} +' +customElements +. +getName +must +throw +a +TypeError +when +the +element +interface +is +undefined +' +) +; +assert_throws_js +( +TypeError +function +( +) +{ +customElements +. +getName +( +null +) +; +} +' +customElements +. +getName +must +throw +a +TypeError +when +the +element +interface +is +null +' +) +; +assert_throws_js +( +TypeError +function +( +) +{ +customElements +. +getName +( +' +foo +- +bar +' +) +; +} +' +customElements +. +getName +must +throw +a +TypeError +when +the +element +interface +is +a +string +' +) +; +assert_throws_js +( +TypeError +function +( +) +{ +customElements +. +getName +( +1 +) +; +} +' +customElements +. +getName +must +throw +a +TypeError +when +the +element +interface +is +a +number +' +) +; +assert_throws_js +( +TypeError +function +( +) +{ +customElements +. +getName +( +{ +} +) +; +} +' +customElements +. +getName +must +throw +a +TypeError +when +the +element +interface +is +an +object +' +) +; +assert_throws_js +( +TypeError +function +( +) +{ +customElements +. +getName +( +[ +] +) +} +' +customElements +. +getName +must +throw +a +TypeError +when +the +element +interface +is +an +array +' +) +; +} +' +customElements +. +getName +must +throw +when +the +element +interface +is +not +a +constructor +' +) +; +test +( +function +( +) +{ +class +OtherExistingCustomElement +extends +HTMLElement +{ +} +; +class +SecondExistingCustomElement +extends +HTMLElement +{ +} +; +assert_throws_js +( +TypeError +function +( +) +{ +customElements +. +getName +( +customElements +. +getName +( +OtherExistingCustomElement +) +) +; +} +' +customElements +. +getName +must +throw +a +TypeError +when +the +element +interface +is +undefined +' +) +; +customElements +. +define +( +' +other +- +existing +- +custom +- +element +' +OtherExistingCustomElement +) +; +customElements +. +define +( +' +second +- +existing +- +custom +- +element +' +SecondExistingCustomElement +) +; +assert_equals +( +customElements +. +getName +( +OtherExistingCustomElement +) +' +other +- +existing +- +custom +- +element +' +) +; +assert_equals +( +customElements +. +getName +( +SecondExistingCustomElement +) +' +second +- +existing +- +custom +- +element +' +) +; +} +' +customElements +. +getName +returns +the +name +of +the +entry +with +the +given +constructor +when +there +is +a +matching +entry +. +' +) +; +test +( +function +( +) +{ +class +ButtonCustomBuiltInElement +extends +HTMLButtonElement +{ +} +; +class +InputCustomBuiltInElement +extends +HTMLInputElement +{ +} +; +customElements +. +define +( +' +button +- +custom +- +built +- +in +- +element +' +ButtonCustomBuiltInElement +{ +extends +: +' +button +' +} +) +; +customElements +. +define +( +' +input +- +custom +- +built +- +in +- +element +' +InputCustomBuiltInElement +{ +extends +: +' +input +' +} +) +; +assert_equals +( +customElements +. +getName +( +ButtonCustomBuiltInElement +) +' +button +- +custom +- +built +- +in +- +element +' +) +; +assert_equals +( +customElements +. +getName +( +InputCustomBuiltInElement +) +' +input +- +custom +- +built +- +in +- +element +' +) +; +} +' +customElements +. +getName +returns +the +name +of +the +entry +with +the +given +customized +built +in +constructor +when +there +is +a +matching +entry +. +' +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/custom-elements/CustomElementRegistry.html b/testing/web-platform/tests/custom-elements/CustomElementRegistry.html index 78e0a6e37404..5ee9fbec94bc 100644 --- a/testing/web-platform/tests/custom-elements/CustomElementRegistry.html +++ b/testing/web-platform/tests/custom-elements/CustomElementRegistry.html @@ -5666,567 +5666,6 @@ ( ) { -assert_equals -( -customElements -. -getName -( -class -extends -HTMLElement -{ -} -) -null -) -; -} -' -customElements -. -getName -must -return -null -when -the -registry -does -not -contain -an -entry -with -the -given -constructor -' -) -; -test -( -function -( -) -{ -assert_throws_js -( -TypeError -function -( -) -{ -customElements -. -getName -( -undefined -) -; -} -' -customElements -. -getName -must -throw -a -TypeError -when -the -element -interface -is -undefined -' -) -; -assert_throws_js -( -TypeError -function -( -) -{ -customElements -. -getName -( -null -) -; -} -' -customElements -. -getName -must -throw -a -TypeError -when -the -element -interface -is -null -' -) -; -assert_throws_js -( -TypeError -function -( -) -{ -customElements -. -getName -( -' -foo -- -bar -' -) -; -} -' -customElements -. -getName -must -throw -a -TypeError -when -the -element -interface -is -a -string -' -) -; -assert_throws_js -( -TypeError -function -( -) -{ -customElements -. -getName -( -1 -) -; -} -' -customElements -. -getName -must -throw -a -TypeError -when -the -element -interface -is -a -number -' -) -; -assert_throws_js -( -TypeError -function -( -) -{ -customElements -. -getName -( -{ -} -) -; -} -' -customElements -. -getName -must -throw -a -TypeError -when -the -element -interface -is -an -object -' -) -; -assert_throws_js -( -TypeError -function -( -) -{ -customElements -. -getName -( -[ -] -) -} -' -customElements -. -getName -must -throw -a -TypeError -when -the -element -interface -is -an -array -' -) -; -} -' -customElements -. -getName -must -throw -when -the -element -interface -is -not -a -constructor -' -) -; -test -( -function -( -) -{ -class -OtherExistingCustomElement -extends -HTMLElement -{ -} -; -class -SecondExistingCustomElement -extends -HTMLElement -{ -} -; -assert_throws_js -( -TypeError -function -( -) -{ -customElements -. -getName -( -customElements -. -getName -( -OtherExistingCustomElement -) -) -; -} -' -customElements -. -getName -must -throw -a -TypeError -when -the -element -interface -is -undefined -' -) -; -customElements -. -define -( -' -other -- -existing -- -custom -- -element -' -OtherExistingCustomElement -) -; -customElements -. -define -( -' -second -- -existing -- -custom -- -element -' -SecondExistingCustomElement -) -; -assert_equals -( -customElements -. -getName -( -OtherExistingCustomElement -) -' -other -- -existing -- -custom -- -element -' -) -; -assert_equals -( -customElements -. -getName -( -SecondExistingCustomElement -) -' -second -- -existing -- -custom -- -element -' -) -; -} -' -customElements -. -getName -returns -the -name -of -the -entry -with -the -given -constructor -when -there -is -a -matching -entry -. -' -) -; -test -( -function -( -) -{ -class -ButtonCustomBuiltInElement -extends -HTMLButtonElement -{ -} -; -class -InputCustomBuiltInElement -extends -HTMLInputElement -{ -} -; -customElements -. -define -( -' -button -- -custom -- -built -- -in -- -element -' -ButtonCustomBuiltInElement -{ -extends -: -' -button -' -} -) -; -customElements -. -define -( -' -input -- -custom -- -built -- -in -- -element -' -InputCustomBuiltInElement -{ -extends -: -' -input -' -} -) -; -assert_equals -( -customElements -. -getName -( -ButtonCustomBuiltInElement -) -' -button -- -custom -- -built -- -in -- -element -' -) -; -assert_equals -( -customElements -. -getName -( -InputCustomBuiltInElement -) -' -input -- -custom -- -built -- -in -- -element -' -) -; -} -' -customElements -. -getName -returns -the -name -of -the -entry -with -the -given -customized -built -in -constructor -when -there -is -a -matching -entry -. -' -) -; -test -( -function -( -) -{ assert_true ( customElements