mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
migrate tests to new html runner
This commit is contained in:
22
src/tests/polyfill/webcomponents.html
Normal file
22
src/tests/polyfill/webcomponents.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<script src="../testing.js"></script>
|
||||
|
||||
<div id=main></div>
|
||||
|
||||
<script id=webcomponents>
|
||||
class LightPanda extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
connectedCallback() {
|
||||
this.append('connected');
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define("lightpanda-test", LightPanda);
|
||||
const main = document.getElementById('main');
|
||||
main.appendChild(document.createElement('lightpanda-test'));
|
||||
|
||||
testing.expectEqual('<lightpanda-test>connected</lightpanda-test>', main.innerHTML)
|
||||
testing.expectEqual('[object DataSet]', document.createElement('lightpanda-test').dataset.toString());
|
||||
testing.expectEqual('[object DataSet]', document.createElement('lightpanda-test.x').dataset.toString());
|
||||
</script>
|
||||
25
src/tests/storage/local_storage.html
Normal file
25
src/tests/storage/local_storage.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<script src="../testing.js"></script>
|
||||
|
||||
<script id=localstorage>
|
||||
testing.expectEqual(0, localStorage.length);
|
||||
testing.expectEqual(null, localStorage.getItem('foo'));
|
||||
|
||||
localStorage.setItem('foo', 'bar');
|
||||
testing.expectEqual(1, localStorage.length)
|
||||
testing.expectEqual('bar', localStorage.getItem('foo'));
|
||||
|
||||
localStorage.removeItem('foo');
|
||||
testing.expectEqual(0, localStorage.length)
|
||||
testing.expectEqual(null, localStorage.getItem('foo'));
|
||||
|
||||
localStorage['foo'] = 'bar';
|
||||
testing.expectEqual(1, localStorage.length);
|
||||
testing.expectEqual('bar', localStorage['foo']);
|
||||
|
||||
localStorage.setItem('a', '1');
|
||||
localStorage.setItem('b', '2');
|
||||
localStorage.setItem('c', '3');
|
||||
testing.expectEqual(3, localStorage.length)
|
||||
localStorage.clear();
|
||||
localStorage.length", "0" },
|
||||
</script>
|
||||
Reference in New Issue
Block a user