Skip to content

Commit 5e1043a

Browse files
authored
Merge pull request #701 from BY00565233/SURF-2022
test(hx-search-assistance): surf-2022
2 parents 477d2d9 + 60c22a4 commit 5e1043a

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { fixture, expect } from '@open-wc/testing';
2+
3+
/**
4+
* <hx-search-assistance> component tests
5+
*
6+
* @type HXSearchAssistanceElement
7+
*
8+
*/
9+
describe('<hx-search-assistance> component tests', () => {
10+
const template = '<hx-search-assistance>';
11+
12+
describe('test instantiate element', () => {
13+
it('should be instantiated with hx-defined attribute', async () => {
14+
const component = /** @type {HXSearchAssistanceElement} */ await fixture(template);
15+
const attr = component.hasAttribute('hx-defined');
16+
17+
expect(attr).to.be.true;
18+
});
19+
20+
it('should not be hidden', async () => {
21+
const component = /** @type {HXSearchAssistanceElement} */ await fixture(template);
22+
const prop = component.hidden;
23+
24+
expect(prop).to.be.false;
25+
});
26+
27+
it(`the rendered Light DOM should NOT equal simple template ${template}`, async () => {
28+
const component = /** @type {HXSearchAssistanceElement} */ await fixture(template);
29+
30+
expect(component).lightDom.to.not.equal(template);
31+
});
32+
33+
it(`should NOT have a Shadow DOM`, async () => {
34+
const component = /** @type {HXSearchAssistanceElement} */ await fixture(template);
35+
const shadow = component.shadowRoot;
36+
37+
expect(shadow).to.be.null;
38+
});
39+
});
40+
41+
describe('verify onCreate method', () => {
42+
it('test for default position', async () => {
43+
const component = /** @type {HXSearchAssistanceElement} */ await fixture(template);
44+
const defaultPosition = 'bottom-start';
45+
const attr = component.hasAttribute('position');
46+
const bottomStart = component.getAttribute('position');
47+
48+
expect(attr).to.be.true;
49+
expect(bottomStart).to.equal(defaultPosition);
50+
});
51+
});
52+
});

0 commit comments

Comments
 (0)