github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/webapp/components/test/wpt-permalinks.html (about) 1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script src="../../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script> 6 <script src="../../node_modules/wct-browser-legacy/browser.js"></script> 7 </head> 8 <body> 9 <test-fixture id="wpt-permalinks-fixture"> 10 <template> 11 <wpt-permalinks></wpt-permalinks> 12 </template> 13 </test-fixture> 14 15 <script type="module"> 16 import '../wpt-permalinks.js'; 17 18 suite('wpt-permalinks', () => { 19 let sandbox, permalinks; 20 21 setup(() => { 22 permalinks = fixture('wpt-permalinks-fixture'); 23 sandbox = sinon.sandbox.create(); 24 }); 25 26 teardown(() => { 27 sandbox.restore(); 28 }); 29 30 suite('include search', () => { 31 test('run ids', () => { 32 permalinks.queryParams = {q: 'foo'}; 33 permalinks.selectedTab = 0; 34 permalinks.includeSearch = true; 35 expect(`${permalinks.url}`).to.include('q=foo'); 36 permalinks.includeSearch = false; 37 expect(`${permalinks.url}`).to.not.include('q=foo'); 38 }); 39 40 test('query params', () => { 41 permalinks.queryParams = {q: 'bar'}; 42 permalinks.selectedTab = 1; 43 permalinks.includeSearch = true; 44 expect(`${permalinks.url}`).to.include('q=bar'); 45 permalinks.includeSearch = false; 46 expect(`${permalinks.url}`).to.not.include('q=bar'); 47 }); 48 }); 49 }); 50 </script> 51 </body> 52 </html>