Skip to content

Truly independent web browser

Tests/LibWeb: Import WPT test for links in contenteditable

Andreas Kling518e72f603d8
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-input-element/anchor-contenteditable-navigate.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-input-element/anchor-contenteditable-navigate.txt
new file mode 100644
index 00000000000..8a0535353cf
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-input-element/anchor-contenteditable-navigate.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Pass
+Pass Anchor elements should not be able to navigate if they have contentEditable.
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/forms/the-input-element/anchor-contenteditable-navigate.html b/Tests/LibWeb/Text/input/wpt-import/html/semantics/forms/the-input-element/anchor-contenteditable-navigate.html
new file mode 100644
index 00000000000..efc7b82a90b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/forms/the-input-element/anchor-contenteditable-navigate.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="author" title="Joey Arhar" href="mailto:[email protected]">
+
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<script src="../../../../resources/testdriver.js"></script>
+<script src="../../../../resources/testdriver-actions.js"></script>
+<script src="../../../../resources/testdriver-vendor.js"></script>
+
+<!-- This behavior is not explicitly specified. -->
+
+<a id=anchorid href="javascript:window.anchornavigated = true;">anchor</a>
+
+<script>
+promise_test(async () => {
+ window.anchornavigated = false;
+
+ anchorid.contentEditable = true;
+ await test_driver.click(anchorid);
+
+ assert_false(window.anchornavigated, "Anchor's javascript: url was run.");
+
+}, 'Anchor elements should not be able to navigate if they have contentEditable.');
+</script>