Skip to content

Commit 6760136

Browse files
committed
test(stepper): implement component tests
1 parent 6ac257b commit 6760136

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

src/elements/hx-accordion/index.spec.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,59 @@ describe('<hx-accordion> component tests', () => {
7171
});
7272
});
7373

74+
/**
75+
* Stepper Component Tests
76+
*
77+
* CSS-based derivative of Accordion Component.
78+
*
79+
* @type HXAccordionElement
80+
*/
81+
describe('Stepper Component tests', () => {
82+
const mockup =`
83+
<hx-accordion class="hxStepper" current-panel="0">
84+
<hx-accordion-panel>
85+
<header slot="header">
86+
<span class="hxStepCounter"></span>
87+
<span class="hxStepLabel">Account</span>
88+
<span class="hxStepValue">Acme Corp Inc.</span>
89+
</header>
90+
<div class="hxBox hxMd">
91+
<p>
92+
<em>Content Goes Here</em>
93+
</p>
94+
<p class="hxStepButton">
95+
<button class="hxBtn hxPrimary">Next Step</button>
96+
<button class="hxBtn">Prev Step</button>
97+
<button class="hxBtn hxLink">Cancel</button>
98+
</p>
99+
</div>
100+
</hx-accordion-panel>
101+
<hx-accordion-panel>...</hx-accordion-panel>
102+
<hx-accordion-panel>...</hx-accordion-panel>
103+
</hx-accordion>`;
104+
105+
describe('instantiate element', () => {
106+
it('should be instantiated with hx-defined attribute', async () => {
107+
const fragment = /** @type {HXAccordionElement} */ await fixture(mockup);
108+
const attr = fragment.hasAttribute('hx-defined');
109+
110+
expect(attr).to.be.true;
111+
});
112+
113+
it('should not be hidden', async () => {
114+
const fragment = /** @type {HXAccordionElement} */ await fixture(mockup);
115+
const prop = fragment.hidden;
116+
117+
expect(prop).to.be.false;
118+
});
119+
120+
it('should contain hxStepper class', async () => {
121+
const className = 'hxStepper';
122+
const fragment = /** @type {HXAccordionElement} */ await fixture(mockup);
123+
const queryClass = fragment.className;
124+
125+
expect(queryClass).to.equal(className);
126+
});
127+
});
128+
});
74129
});

0 commit comments

Comments
 (0)