@muonic/muon 0.0.2-beta.29 → 0.0.2-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.2-beta.30](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.29...v0.0.2-beta.30) (2023-07-24)
|
|
6
|
+
|
|
5
7
|
### [0.0.2-beta.29](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.28...v0.0.2-beta.29) (2023-07-20)
|
|
6
8
|
|
|
7
9
|
### [0.0.2-beta.28](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.27...v0.0.2-beta.28) (2023-07-14)
|
package/package.json
CHANGED
|
@@ -239,3 +239,21 @@ snapshots["cta implements template `reset`"] =
|
|
|
239
239
|
`;
|
|
240
240
|
/* end snapshot cta implements template `reset` */
|
|
241
241
|
|
|
242
|
+
snapshots["cta default"] =
|
|
243
|
+
`<div
|
|
244
|
+
aria-label=""
|
|
245
|
+
class="cta standard"
|
|
246
|
+
>
|
|
247
|
+
<span class="label-holder">
|
|
248
|
+
<slot>
|
|
249
|
+
</slot>
|
|
250
|
+
</span>
|
|
251
|
+
<cta-icon
|
|
252
|
+
class="icon"
|
|
253
|
+
name="arrow-right"
|
|
254
|
+
>
|
|
255
|
+
</cta-icon>
|
|
256
|
+
</div>
|
|
257
|
+
`;
|
|
258
|
+
/* end snapshot cta default */
|
|
259
|
+
|
|
@@ -7,6 +7,37 @@ const tagName = defineCE(Cta);
|
|
|
7
7
|
const tag = unsafeStatic(tagName);
|
|
8
8
|
|
|
9
9
|
describe('cta', () => {
|
|
10
|
+
it('default', async () => {
|
|
11
|
+
const el = await fixture(html`<${tag}></${tag}>`);
|
|
12
|
+
|
|
13
|
+
await defaultChecks(el, { skipAccessibility: true });
|
|
14
|
+
|
|
15
|
+
const shadowRoot = el.shadowRoot;
|
|
16
|
+
const cta = shadowRoot.querySelector('.cta');
|
|
17
|
+
const icon = cta.querySelector('.icon');
|
|
18
|
+
const label = cta.querySelector('.label-holder');
|
|
19
|
+
|
|
20
|
+
expect(el.type).to.equal('standard', '`type` property has default value `standard`');
|
|
21
|
+
expect(el.icon).to.equal('arrow-right', '`icon` property has default value `arrow-right`');
|
|
22
|
+
expect(el.loading).to.equal(false, '`loading` property has default value `false`');
|
|
23
|
+
expect(el.loadingMessage).to.equal('Loading...', '`loadingMessage` property has default value `Loading...`');
|
|
24
|
+
expect(el.href).to.equal(undefined, '`href` attribute has no default value');
|
|
25
|
+
expect(el._iconPosition).to.equal('end', '`_iconPosition` attribute has default value `end`');
|
|
26
|
+
expect(el._isButton).to.equal(undefined, '`_isButton` attribute has no default value');
|
|
27
|
+
expect(el.getAttribute('role')).to.equal('button', 'has the role of button');
|
|
28
|
+
expect(el.getAttribute('tabindex')).to.equal('0', 'has a tab index');
|
|
29
|
+
expect(el.getAttribute('aria-disabled')).to.equal(null, '`disabled aria` has not been set');
|
|
30
|
+
expect(cta.nodeName).to.equal('DIV', 'parent element inside shadow should be `div`');
|
|
31
|
+
// eslint-disable-next-line no-unused-expressions
|
|
32
|
+
expect(cta.getAttribute('aria-label')).to.empty;
|
|
33
|
+
expect(cta.getAttribute('tabindex')).to.equal(null, 'has no tab index');
|
|
34
|
+
expect(cta.getAttribute('disabled')).to.equal(null, 'cta is not disabled');
|
|
35
|
+
expect(cta.children[0].nodeName).to.equal('SPAN', 'first element within cta is span');
|
|
36
|
+
expect(cta.children[1].nodeName).to.equal('CTA-ICON', 'second element within cta is icon');
|
|
37
|
+
expect(icon.nodeName).to.equal('CTA-ICON', 'Scoped CTA component');
|
|
38
|
+
expect(icon.name).to.equal('arrow-right', 'Scoped icon has name value `arrow-right`');
|
|
39
|
+
expect(label.nodeName).to.equal('SPAN', 'span label holder exists');
|
|
40
|
+
});
|
|
10
41
|
it('implements standard self', async () => {
|
|
11
42
|
const el = await fixture(html`<${tag}>Buy a doughnut</${tag}>`);
|
|
12
43
|
|
package/tests/helpers/index.js
CHANGED
|
@@ -11,10 +11,12 @@ export const defaultChecks = async (el, options = {}) => {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (!options.skipAccessibility) {
|
|
15
|
+
await expect(el).to.be.accessible({
|
|
16
|
+
ignoredRules,
|
|
17
|
+
ignoredTags
|
|
18
|
+
});
|
|
19
|
+
}
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export const fireEvent = async (element, event) => {
|