Skip to content

Commit 37e8694

Browse files
chore: add tests for custom elements properties
1 parent 72963d4 commit 37e8694

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
mode: ['client', 'server'],
5+
async test({ assert, target }) {
6+
const my_element = /** @type HTMLElement & { object: { test: true }; } */ (target.querySelector('my-element'));
7+
const my_link = /** @type HTMLAnchorElement & { object: { test: true }; } */ (target.querySelector('a'));
8+
assert.equal(my_element.getAttribute('string'), 'test');
9+
assert.equal(my_element.hasAttribute('object'), false);
10+
assert.deepEqual(my_element.object, { test: true });
11+
assert.equal(my_link.getAttribute('string'), 'test');
12+
assert.equal(my_link.hasAttribute('object'), false);
13+
assert.deepEqual(my_link.object, { test: true });
14+
}
15+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<my-element string="test" object={{ test: true }}></my-element>
2+
<a is="my-link" string="test" object={{ test: true }}></a>

0 commit comments

Comments
 (0)