browser_rules_add-rule-namespace-elements.js (1134B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Tests the behaviour of adding a new rule using the add rule button 7 // on namespaced elements. 8 9 const XHTML = ` 10 <!DOCTYPE html> 11 <html xmlns="http://www.w3.org/1999/xhtml" 12 xmlns:svg="http://www.w3.org/2000/svg"> 13 <body> 14 <svg:svg width="100" height="100"> 15 <svg:clipPath> 16 <svg:rect x="0" y="0" width="10" height="5"></svg:rect> 17 </svg:clipPath> 18 <svg:circle cx="0" cy="0" r="5"></svg:circle> 19 </svg:svg> 20 </body> 21 </html> 22 `; 23 const TEST_URI = "data:application/xhtml+xml;charset=utf-8," + encodeURI(XHTML); 24 25 const TEST_DATA = [ 26 { node: "clipPath", expected: "clipPath" }, 27 { node: "rect", expected: "rect" }, 28 { node: "circle", expected: "circle" }, 29 ]; 30 31 add_task(async function () { 32 await addTab(TEST_URI); 33 const { inspector, view } = await openRuleView(); 34 35 for (const data of TEST_DATA) { 36 const { node, expected } = data; 37 await selectNode(node, inspector); 38 await addNewRuleAndDismissEditor(inspector, view, expected, 1); 39 } 40 });