From 19155741657058109f609ec57d651b9d5e974db5 Mon Sep 17 00:00:00 2001 From: Konstantin Konstantin Date: Sun, 1 Dec 2024 21:04:44 +0100 Subject: [PATCH] LibWeb: Fix NavigationType enum to string conversion Convert NavigationType to lowercase strings, as described in the spec. Import related WPT test. --- Libraries/LibWeb/HTML/NavigationType.h | 8 +- .../navigation/navigation-navigate.txt | 4 +- .../navigate-event/event-constructor.txt | 16 +++ .../navigate-event/event-constructor.html | 119 ++++++++++++++++++ 4 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/wpt-import/navigation-api/navigate-event/event-constructor.txt create mode 100644 Tests/LibWeb/Text/input/wpt-import/navigation-api/navigate-event/event-constructor.html diff --git a/Libraries/LibWeb/HTML/NavigationType.h b/Libraries/LibWeb/HTML/NavigationType.h index 388d0576c00..277ac9bc3e2 100644 --- a/Libraries/LibWeb/HTML/NavigationType.h +++ b/Libraries/LibWeb/HTML/NavigationType.h @@ -21,13 +21,13 @@ inline String idl_enum_to_string(NavigationType value) { switch (value) { case NavigationType::Push: - return "Push"_string; + return "push"_string; case NavigationType::Replace: - return "Replace"_string; + return "replace"_string; case NavigationType::Reload: - return "Reload"_string; + return "reload"_string; case NavigationType::Traverse: - return "Traverse"_string; + return "traverse"_string; default: return ""_string; } diff --git a/Tests/LibWeb/Text/expected/navigation/navigation-navigate.txt b/Tests/LibWeb/Text/expected/navigation/navigation-navigate.txt index a73046c7249..712cd7713be 100644 --- a/Tests/LibWeb/Text/expected/navigation/navigation-navigate.txt +++ b/Tests/LibWeb/Text/expected/navigation/navigation-navigate.txt @@ -1,6 +1,6 @@ Initial history length is 1 -NavigateEvent for Push navigation-navigate-iframe.html#1 (Same document? true) with info: 42 -currententrychange for change to navigation-navigate-iframe.html#1 of type Push from navigation-navigate-iframe.html +NavigateEvent for push navigation-navigate-iframe.html#1 (Same document? true) with info: 42 +currententrychange for change to navigation-navigate-iframe.html#1 of type push from navigation-navigate-iframe.html Committed to navigation to navigation-navigate-iframe.html#1 Finished navigation to navigation-navigate-iframe.html#1 History length after navigate is 2 diff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/navigate-event/event-constructor.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/navigate-event/event-constructor.txt new file mode 100644 index 00000000000..e3a7f5b87e2 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/navigate-event/event-constructor.txt @@ -0,0 +1,16 @@ +Summary + +Harness status: OK + +Rerun + +Found 6 tests + +6 Pass +Details +Result Test Name MessagePass can't bypass required members by omitting the dictionary entirely +Pass destination is required +Pass signal is required +Pass all properties are reflected back +Pass defaults are as expected +Pass hasUAVisualTransition is default false \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/navigation-api/navigate-event/event-constructor.html b/Tests/LibWeb/Text/input/wpt-import/navigation-api/navigate-event/event-constructor.html new file mode 100644 index 00000000000..a7d86b9a75f --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/navigation-api/navigate-event/event-constructor.html @@ -0,0 +1,119 @@ + + + +