@muonic/muon 0.0.2-experimental-125-e41d6ed.0 → 0.0.2-experimental-128-ff1cfa2.0

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.
@@ -1,15 +1,23 @@
1
1
  import { Card } from '@muonic/muon/components/card';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
3
  import { StandardLink as CTALink } from '../cta/story';
4
+ import { staticHTML, unsafeStatic } from '@muonic/muon';
4
5
 
5
6
  const details = setup('card', Card);
6
7
 
7
- export default details.defaultValues;
8
+ export default {
9
+ ...details.defaultValues,
10
+ parameters: {
11
+ controls: {
12
+ exclude: ['standardTemplate']
13
+ }
14
+ }
15
+ };
8
16
 
9
- const innerDetail = (args) => `
10
- <h2 slot="header">${args.header}</h2>
11
- ${args.content}
12
- <div slot="footer">${args.footer}</div>
17
+ const innerDetail = (args) => staticHTML`
18
+ <h2 slot="header">${unsafeStatic(args.header)}</h2>
19
+ ${unsafeStatic(args.content)}
20
+ <div slot="footer">${unsafeStatic(args.footer)}</div>
13
21
  `;
14
22
 
15
23
  const StandardTemplate = (args) => details.template(args, innerDetail);
@@ -31,14 +39,14 @@ StandardWithImage.args = {
31
39
  footer: `We've even got a free <a href='#!'>smartphone app</a>.`
32
40
  };
33
41
 
34
- const innerDetailWithCTA = (args) => `
35
- <h2 slot="header">${args.header}</h2>
36
- ${args.content}
37
- <div slot="footer">${CTALink(args.footer)}</div>
42
+ const innerDetailWithCTA = (args) => staticHTML`
43
+ <h2 slot="header">${unsafeStatic(args.header)}</h2>
44
+ ${unsafeStatic(args.content)}
45
+ <div slot="footer">${CTALink(args.cta)}</div>
38
46
  `;
39
47
  export const StandardWithCTA = (args) => details.template(args, innerDetailWithCTA);
40
48
  StandardWithCTA.args = {
41
49
  header: 'Where can I buy an ice cream?',
42
50
  content: `<p>We have the most wonderful shop just in town, that sells a whole variety of different ice creams. Just pop on in and we can get you sorted with your favourite flavour!</p>`,
43
- footer: { text: 'Click Here', href: '#!' }
51
+ cta: { ...CTALink.args, text: 'Click Here', href: '#!' }
44
52
  };
@@ -1,20 +1,28 @@
1
1
  import { Cta } from '@muonic/muon/components/cta';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
+ import { staticHTML } from '@muonic/muon';
3
4
 
4
5
  const details = setup('cta', Cta);
5
6
  const tag = details.getTagEl();
6
7
 
7
- export default details.defaultValues;
8
+ export default {
9
+ ...details.defaultValues,
10
+ parameters: {
11
+ controls: {
12
+ exclude: ['standardTemplate', 'submitTemplate', 'resetTemplate', 'loading-message']
13
+ }
14
+ }
15
+ };
8
16
 
9
- const StandardTemplate = (args) => details.template(args, (args) => args.text);
17
+ const StandardTemplate = (args) => staticHTML`${details.template(args, (args) => args.text)}`;
10
18
  const ButtonTemplate = (args) => {
11
19
  const dArgs = details.dynamicArgs(args);
12
20
 
13
- return `<${tag} ${dArgs} ._isButton=${true}>${args.text}</${tag}>`;
21
+ return staticHTML`<${tag} ${dArgs} ._isButton=${true}>${args.text}</${tag}>`;
14
22
  };
15
- const FormTemplate = (args) => `<form>${details.template(args, (args) => args.text)}</form>`;
16
- const WithinLinkTemplate = (args) => `<a href="${args.link}">${details.template(args, (args) => args.text)}</a>`;
17
- const WithinButtonTemplate = (args) => `<button>${details.template(args, (args) => args.text)}</button>`;
23
+ const FormTemplate = (args) => staticHTML`<form>${StandardTemplate(args)}</form>`;
24
+ const WithinLinkTemplate = (args) => staticHTML`<a href="${args.link}">${StandardTemplate(args)}</a>`;
25
+ const WithinButtonTemplate = (args) => staticHTML`<button>${StandardTemplate(args)}</button>`;
18
26
 
19
27
  export const Standard = StandardTemplate.bind({});
20
28
  Standard.args = { text: 'Highpoint' };
@@ -1,13 +1,21 @@
1
1
  import { Detail } from '@muonic/muon/components/detail';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
+ import { staticHTML, unsafeStatic } from '@muonic/muon';
3
4
 
4
5
  const details = setup('detail', Detail);
5
6
 
6
- export default details.defaultValues;
7
+ export default {
8
+ ...details.defaultValues,
9
+ parameters: {
10
+ controls: {
11
+ exclude: ['standardTemplate']
12
+ }
13
+ }
14
+ };
7
15
 
8
- const innerDetail = (args) => `
9
- <div slot="heading">${args.heading}</div>
10
- ${args.content}
16
+ const innerDetail = (args) => staticHTML`
17
+ <div slot="heading">${unsafeStatic(args.heading)}</div>
18
+ ${unsafeStatic(args.content)}
11
19
  `;
12
20
 
13
21
  const StandardTemplate = (args) => details.template(args, innerDetail);
@@ -0,0 +1,11 @@
1
+ {
2
+ "form": {
3
+ "config": {
4
+ "type": {
5
+ "description": "Default value for `type` property which renders the template.",
6
+ "value": "standard",
7
+ "type": "string"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "form": {
3
+ "row": {
4
+ "gap": {
5
+ "value": "{ theme.spacer.lg.value }"
6
+ }
7
+ }
8
+ }
9
+ }
@@ -1,5 +1,6 @@
1
- import { html, MuonElement } from '@muonic/muon';
1
+ import { html, MuonElement, css, unsafeCSS } from '@muonic/muon';
2
2
  import scrollTo from '@muon/utils/scroll';
3
+ import styles from './form-styles.css';
3
4
 
4
5
  /**
5
6
  * A form.
@@ -15,6 +16,10 @@ export class Form extends MuonElement {
15
16
  this._reset = this._reset.bind(this);
16
17
  }
17
18
 
19
+ static get styles() {
20
+ return css`${unsafeCSS(styles)}`;
21
+ }
22
+
18
23
  connectedCallback() {
19
24
  super.connectedCallback();
20
25
 
@@ -178,9 +183,7 @@ export class Form extends MuonElement {
178
183
 
179
184
  get standardTemplate() {
180
185
  return html`
181
- <div class="form">
182
- <slot></slot>
183
- </div>
186
+ <slot></slot>
184
187
  `;
185
188
  }
186
189
  }
@@ -0,0 +1,10 @@
1
+ @import "@muonic/muon/css/default.css";
2
+
3
+ :host {
4
+ display: block;
5
+
6
+ & ::slotted(.layout-row) {
7
+ display: grid;
8
+ row-gap: $FORM_ROW_GAP;
9
+ }
10
+ }
@@ -1,38 +1,56 @@
1
1
  import { Form } from '@muonic/muon/components/form';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
- import { Text, Email, Checkbox } from '../inputter/story';
3
+ import * as InputterStories from '../inputter/story';
4
4
  import { Standard as SubmitCTA } from '../cta/story';
5
+ import { staticHTML } from '@muonic/muon';
5
6
 
6
7
  const details = setup('form', Form);
7
8
 
8
- export default details.defaultValues;
9
+ export default {
10
+ ...details.defaultValues,
11
+ parameters: {
12
+ controls: {
13
+ exclude: ['standardTemplate', 'submit']
14
+ }
15
+ }
16
+ };
9
17
 
10
- const innerDetail = () => `
11
- <form>
12
- ${Text({ ...Text.args,
18
+ const innerDetail = (args) => staticHTML`
19
+ <form>
20
+ ${InputterStories.Text(args.Text)}
21
+ ${InputterStories.Email(args.Email)}
22
+
23
+ <label for="user-id">User ID<label>
24
+ <input type="text" id="user-id" name="user-id" required/>
25
+
26
+ ${InputterStories.Checkbox(args.Checkbox)}
27
+
28
+ <input type="reset" />
29
+ ${SubmitCTA(args.Submit)}
30
+ <form>`;
31
+
32
+ export const Standard = (args) => details.template(args, innerDetail);
33
+ Standard.args = {
34
+ Text: {
35
+ ...InputterStories.Text.args,
13
36
  name: 'username',
14
37
  label: 'Name'
15
- })}
16
- ${Email({ ...Email.args,
38
+ },
39
+ Email: {
40
+ ...InputterStories.Email.args,
17
41
  name: 'useremail'
18
- })}
19
-
20
- <label for="user-id">User ID<label>
21
- <input type="text" id="user-id" name="user-id" required/>
22
-
23
- ${Checkbox({ ...Checkbox.args,
42
+ },
43
+ Checkbox: {
44
+ ...InputterStories.Checkbox.args,
24
45
  value: 'b',
25
46
  options: [
26
47
  { label: 'Option A', value: 'a' },
27
48
  { label: 'Option B', value: 'b' }
28
49
  ]
29
- })}
30
-
31
- <input type="reset" />
32
- ${SubmitCTA({ ...SubmitCTA.args,
50
+ },
51
+ Submit: {
52
+ ...SubmitCTA.args,
33
53
  type: 'submit',
34
54
  text: 'Submit'
35
- })}
36
- <form>`;
37
-
38
- export const Standard = (args) => details.template(args, innerDetail);
55
+ }
56
+ };
@@ -6,22 +6,21 @@ import {
6
6
 
7
7
  const details = setup('icon', Icon);
8
8
 
9
- details.defaultValues.argTypes = {
10
- ...details.defaultValues.argTypes,
11
- iconSize: {
12
- table: {
13
- disable: true
9
+ export default {
10
+ ...details.defaultValues,
11
+ parameters: {
12
+ controls: {
13
+ exclude: ['standardTemplate', 'sizes', 'iconSize', 'allSizes']
14
14
  }
15
15
  },
16
- size: {
17
- control: {
18
- type: 'select',
19
- options: [...ICON_CONFIG_SIZES]
16
+ argTypes: {
17
+ ...details.defaultValues.argTypes,
18
+ size: {
19
+ control:
20
+ { type: 'range', min: 1, max: ICON_CONFIG_SIZES.length, step: 1 }
20
21
  }
21
22
  }
22
23
  };
23
24
 
24
- export default details.defaultValues;
25
-
26
25
  export const Standard = (args) => details.template(args);
27
26
  Standard.args = { name: 'arrow-right' };
@@ -1,9 +1,26 @@
1
1
  import { Image } from '@muonic/muon/components/image';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
+ import { IMAGE_CONFIG_RATIOS } from '@muonic/muon/build/tokens/es6/muon-tokens.mjs';
3
4
 
4
5
  const details = setup('image', Image);
5
6
 
6
- export default details.defaultValues;
7
+ export default {
8
+ ...details.defaultValues,
9
+ parameters: {
10
+ controls: {
11
+ exclude: ['standardTemplate', 'placeholderImage']
12
+ }
13
+ },
14
+ argTypes: {
15
+ ...details.defaultValues.argTypes,
16
+ ratio: {
17
+ options: IMAGE_CONFIG_RATIOS,
18
+ control: {
19
+ type: 'inline-radio'
20
+ }
21
+ }
22
+ }
23
+ };
7
24
 
8
25
  const StandardTemplate = (args) => details.template(args, (args) => args.text);
9
26
 
@@ -1,53 +1,56 @@
1
1
  import { Inputter } from '@muonic/muon/components/inputter';
2
2
  import setup from '@muonic/muon/storybook/stories';
3
3
  import customValidation from '@muon/utils/validation/index.js';
4
+ import { staticHTML, unsafeStatic } from '@muonic/muon';
5
+
4
6
  const details = setup('inputter', Inputter);
5
7
 
6
- details.defaultValues.argTypes = {
7
- ...details.defaultValues.argTypes,
8
- validation: {
9
- control: {
10
- type: 'multi-select',
11
- options: [...Object.keys(customValidation)]
8
+ export default {
9
+ ...details.defaultValues,
10
+ parameters: {
11
+ controls: {
12
+ exclude: ['standardTemplate']
13
+ }
14
+ },
15
+ argTypes: {
16
+ ...details.defaultValues.argTypes,
17
+ validation: {
18
+ control: {
19
+ type: 'multi-select',
20
+ options: [...Object.keys(customValidation)]
21
+ }
12
22
  }
13
23
  }
14
24
  };
15
25
 
16
- export default details.defaultValues;
26
+ const autoCompleteTemplate = (args) => args.autocomplete ? unsafeStatic(`autocomplete="${args.autocomplete}"`) : '';
17
27
 
18
- const labelTemplate = (args) => `
19
- <label slot="label">${args.label}</label>
20
- `;
28
+ const placeHolderTemplate = (args) => args.placeholder ? unsafeStatic(`placeholder="${args.placeholder}"`) : '';
21
29
 
22
- const tipDetailsTemplate = (args) => `
23
- <div slot="tip-details">${args.tip}</div>
24
- `;
30
+ const disabledTemplate = (args) => args.disabled ? unsafeStatic(`disabled`) : '';
25
31
 
26
- const autoCompleteTemplate = (args) => `
27
- ${args.autocomplete ? `autocomplete="${args.autocomplete}"` : ''}
28
- `;
32
+ const labelTemplate = (args) => staticHTML`
33
+ <label slot="label">${args.label}</label>`;
29
34
 
30
- const placeHolderTemplate = (args) => `
31
- ${args.placeholder ? `placeholder="${args.placeholder}"` : ''}
32
- `;
35
+ const tipDetailsTemplate = (args) => staticHTML`
36
+ <div slot="tip-details">${args.tip}</div>`;
33
37
 
34
- const disabledTemplate = (args) => `
35
- ${args.disabled ? `disabled` : ''}
36
- `;
38
+ const inputTemplate = (args) => staticHTML`
39
+ <input type="${args.inputtype}" ${placeHolderTemplate(args)} ${autoCompleteTemplate(args)} ${disabledTemplate(args)}>`;
37
40
 
38
- const slottedContent = (args) => `
41
+ const singleTemplate = (args) => staticHTML`
39
42
  ${args.label ? labelTemplate(args) : ''}
40
- <input type="${args.inputtype}" ${placeHolderTemplate(args)} ${autoCompleteTemplate(args)} ${disabledTemplate(args)}>
41
- ${args.tip ? tipDetailsTemplate(args) : ''}
42
- `;
43
+ ${args.inputtype ? inputTemplate(args) : ''}
44
+ ${args.tip ? tipDetailsTemplate(args) : ''}`;
43
45
 
44
- const InputterStandardTemplate = (args) => details.template(args, slottedContent);
46
+ const InputterStandardTemplate = (args) => details.template(args, singleTemplate);
45
47
  export const Text = InputterStandardTemplate.bind({});
46
48
  Text.args = {
47
49
  inputtype: 'text',
48
50
  label: 'Text',
49
51
  value: '',
50
52
  helper: 'Useful information to help populate this field.',
53
+ tip: '',
51
54
  validation: ['isRequired'],
52
55
  placeholder: 'e.g. Placeholder'
53
56
  };
@@ -138,7 +141,7 @@ Separator.args = {
138
141
  separator: '-'
139
142
  };
140
143
 
141
- const innerNumber = (args) => `
144
+ const innerNumber = (args) => staticHTML`
142
145
  ${args.label ? labelTemplate(args) : ''}
143
146
  <input type="${args.inputtype}" min="${args.min}" max="${args.max}">
144
147
  ${args.tip ? tipDetailsTemplate(args) : ''}
@@ -153,7 +156,7 @@ Number.args = {
153
156
  max: 10
154
157
  };
155
158
 
156
- const innerTextarea = (args) => `
159
+ const innerTextarea = (args) => staticHTML`
157
160
  <label slot="label">${args.label}</label>
158
161
  <textarea placeholder="${args.placeholder}"></textarea>
159
162
  `;
@@ -166,19 +169,25 @@ Textarea.args = {
166
169
  placeholder: 'e.g. Provide information'
167
170
  };
168
171
 
169
- const innerMultiple = (args) => `
172
+ const innerMultiple = (args) => staticHTML`
173
+ <input type="${args.inputtype}" name="${args.name}" value="${args.value}" ${unsafeStatic(args.states?.join(' ') ?? '')} id="${args.id}">
174
+ <label for="${args.id}">${unsafeStatic(args.label)}</label>
175
+ `;
176
+ const multiTemplate = (args) => staticHTML`
170
177
  ${args.options?.map((option, i) => {
171
- const states = option.states?.join(' ') ?? '';
172
178
  const id = `${args.inputtype}-${i + 1}`;
173
- return `
174
- <input type="${args.inputtype}" name="${args.name}" value="${option.value}" ${states} id="${id}">
175
- <label for="${id}">${option.label}</label>
176
- `;
177
- }).join(' ')}
179
+ return staticHTML`${innerMultiple({
180
+ ...args,
181
+ value: option.value,
182
+ label: option.label,
183
+ id,
184
+ states: option.states
185
+ })}`;
186
+ })}
178
187
  ${args.tip ? tipDetailsTemplate(args) : ''}
179
188
  `;
180
189
 
181
- const InputterMultipleTemplate = (args) => details.template(args, innerMultiple);
190
+ const InputterMultipleTemplate = (args) => details.template(args, multiTemplate);
182
191
  export const Checkbox = InputterMultipleTemplate.bind({});
183
192
  Checkbox.args = {
184
193
  inputtype: 'checkbox',
@@ -211,14 +220,14 @@ Radio.args = {
211
220
  ]
212
221
  };
213
222
 
214
- const innerSelect = (args) => `
223
+ const selectTemplate = (args) => staticHTML`
215
224
  <label slot="label">${args.label}</label>
216
225
  <select name="${args.name}">
217
- ${args.options?.map((option) => `<option value="${option.value}">${option.label}</option>`).join(' ')}
226
+ ${args.options?.map((option) => staticHTML`<option value="${option.value}">${option.label}</option>`)}
218
227
  </select>
219
228
  `;
220
229
 
221
- export const Select = (args) => details.template(args, innerSelect);
230
+ export const Select = (args) => details.template(args, selectTemplate);
222
231
  Select.args = {
223
232
  label: 'Select',
224
233
  value: '',
package/index.js CHANGED
@@ -18,7 +18,7 @@ import { cache } from 'lit/directives/cache.js';
18
18
  import { AsyncDirective } from 'lit/async-directive.js';
19
19
  import { ScopedElementsMixin } from '@open-wc/scoped-elements';
20
20
  import { dedupeMixin } from '@open-wc/dedupe-mixin';
21
- import { literal, html as staticHTML } from 'lit/static-html.js';
21
+ import { literal, html as staticHTML, unsafeStatic } from 'lit/static-html.js';
22
22
  import { until } from 'lit/directives/until.js';
23
23
  import { repeat } from 'lit/directives/repeat.js';
24
24
  import { MuonElement } from '@muonic/muon/muon-element';
@@ -43,6 +43,7 @@ export {
43
43
  dedupeMixin,
44
44
  literal,
45
45
  staticHTML,
46
+ unsafeStatic,
46
47
  until,
47
48
  noChange,
48
49
  repeat,
@@ -1,7 +1,7 @@
1
1
  import { html, LitElement, adoptStyles, supportsAdoptingStyleSheets } from '@muonic/muon';
2
- // eslint-disable-next-line jsdoc/valid-types
2
+
3
3
  /**
4
- * @typedef {import('@lit/reactive-element').CSSResultOrNative} CSSResultOrNative
4
+ * @typedef {module:lit.CSSResultOrNative} CSSResultOrNative - define css type
5
5
  */
6
6
 
7
7
  export const MuonElementMixin = (superClass) => class extends superClass {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muonic/muon",
3
- "version": "0.0.2-experimental-125-e41d6ed.0",
3
+ "version": "0.0.2-experimental-128-ff1cfa2.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,3 +1,4 @@
1
+ import { staticHTML, unsafeStatic } from '@muonic/muon';
1
2
  export default (name, el) => {
2
3
  const prefix = process.env.MUON_PREFIX;
3
4
  const element = `${prefix}-${name}`;
@@ -40,7 +41,7 @@ export default (name, el) => {
40
41
  };
41
42
 
42
43
  const getTagEl = () => {
43
- return element;
44
+ return unsafeStatic(element);
44
45
  };
45
46
 
46
47
  const dynamicArgs = (args) => {
@@ -63,14 +64,14 @@ export default (name, el) => {
63
64
  }
64
65
  }).filter((arg) => arg).join(' ');
65
66
 
66
- return dArgs;
67
+ return unsafeStatic(dArgs);
67
68
  };
68
69
 
69
70
  const template = (args, inner) => {
70
71
  const tag = getTagEl();
71
72
  const dArgs = dynamicArgs(args);
72
-
73
- return `<${tag} ${dArgs}>${inner ? inner(args) : ''}</${tag}>`;
73
+ return staticHTML`
74
+ <${tag} ${dArgs}>${inner ? inner(args) : ''}</${tag}>`;
74
75
  };
75
76
 
76
77
  return {
@@ -2,58 +2,44 @@
2
2
  export const snapshots = {};
3
3
 
4
4
  snapshots["form implements standard self [with form]"] =
5
- `<div class="form">
6
- <slot>
7
- </slot>
8
- </div>
5
+ `<slot>
6
+ </slot>
9
7
  `;
10
8
  /* end snapshot form implements standard self [with form] */
11
9
 
12
10
  snapshots["form form with submit button"] =
13
- `<div class="form">
14
- <slot>
15
- </slot>
16
- </div>
11
+ `<slot>
12
+ </slot>
17
13
  `;
18
14
  /* end snapshot form form with submit button */
19
15
 
20
16
  snapshots["form form with submit input"] =
21
- `<div class="form">
22
- <slot>
23
- </slot>
24
- </div>
17
+ `<slot>
18
+ </slot>
25
19
  `;
26
20
  /* end snapshot form form with submit input */
27
21
 
28
22
  snapshots["form form with reset button"] =
29
- `<div class="form">
30
- <slot>
31
- </slot>
32
- </div>
23
+ `<slot>
24
+ </slot>
33
25
  `;
34
26
  /* end snapshot form form with reset button */
35
27
 
36
28
  snapshots["form form with reset input"] =
37
- `<div class="form">
38
- <slot>
39
- </slot>
40
- </div>
29
+ `<slot>
30
+ </slot>
41
31
  `;
42
32
  /* end snapshot form form with reset input */
43
33
 
44
34
  snapshots["form form submitting"] =
45
- `<div class="form">
46
- <slot>
47
- </slot>
48
- </div>
35
+ `<slot>
36
+ </slot>
49
37
  `;
50
38
  /* end snapshot form form submitting */
51
39
 
52
40
  snapshots["form form button disabled submitting"] =
53
- `<div class="form">
54
- <slot>
55
- </slot>
56
- </div>
41
+ `<slot>
42
+ </slot>
57
43
  `;
58
44
  /* end snapshot form form button disabled submitting */
59
45
 
@@ -66,42 +52,32 @@ snapshots["form form submitting validation"] =
66
52
  /* end snapshot form form submitting validation */
67
53
 
68
54
  snapshots["form form submitting with input"] =
69
- `<div class="form">
70
- <slot>
71
- </slot>
72
- </div>
55
+ `<slot>
56
+ </slot>
73
57
  `;
74
58
  /* end snapshot form form submitting with input */
75
59
 
76
60
  snapshots["form form submitting with inputter"] =
77
- `<div class="form">
78
- <slot>
79
- </slot>
80
- </div>
61
+ `<slot>
62
+ </slot>
81
63
  `;
82
64
  /* end snapshot form form submitting with inputter */
83
65
 
84
66
  snapshots["form form submitting with inputter parent"] =
85
- `<div class="form">
86
- <slot>
87
- </slot>
88
- </div>
67
+ `<slot>
68
+ </slot>
89
69
  `;
90
70
  /* end snapshot form form submitting with inputter parent */
91
71
 
92
72
  snapshots["form form with reset cta"] =
93
- `<div class="form">
94
- <slot>
95
- </slot>
96
- </div>
73
+ `<slot>
74
+ </slot>
97
75
  `;
98
76
  /* end snapshot form form with reset cta */
99
77
 
100
78
  snapshots["form form with submit cta"] =
101
- `<div class="form">
102
- <slot>
103
- </slot>
104
- </div>
79
+ `<slot>
80
+ </slot>
105
81
  `;
106
82
  /* end snapshot form form with submit cta */
107
83
 
@@ -114,26 +90,20 @@ snapshots["form form button loading submitting"] =
114
90
  /* end snapshot form form button loading submitting */
115
91
 
116
92
  snapshots["form form cta loading submitting"] =
117
- `<div class="form">
118
- <slot>
119
- </slot>
120
- </div>
93
+ `<slot>
94
+ </slot>
121
95
  `;
122
96
  /* end snapshot form form cta loading submitting */
123
97
 
124
98
  snapshots["form form cta loading reset"] =
125
- `<div class="form">
126
- <slot>
127
- </slot>
128
- </div>
99
+ `<slot>
100
+ </slot>
129
101
  `;
130
102
  /* end snapshot form form cta loading reset */
131
103
 
132
104
  snapshots["form form submitting with inputter [validate]"] =
133
- `<div class="form">
134
- <slot>
135
- </slot>
136
- </div>
105
+ `<slot>
106
+ </slot>
137
107
  `;
138
108
  /* end snapshot form form submitting with inputter [validate] */
139
109
 
@@ -32,14 +32,12 @@ describe('form', () => {
32
32
  await defaultChecks(el);
33
33
 
34
34
  const shadowRoot = el.shadowRoot;
35
- const form = shadowRoot.querySelector('.form');
36
- const slot = form.querySelector('slot');
35
+ const slot = shadowRoot.querySelector('slot');
37
36
  const hiddenSubmit = el.querySelector('input[hidden][type="submit"]');
38
37
 
39
38
  expect(el.type).to.equal('standard', '`type` property has default value `standard`');
40
39
  expect(el._submitButton).to.equal(null, 'no `submit` button added');
41
40
  expect(el._resetButton).to.equal(null, 'no `reset` button added');
42
- expect(form).to.not.be.null; // eslint-disable-line no-unused-expressions
43
41
  expect(slot).to.not.be.null; // eslint-disable-line no-unused-expressions
44
42
  expect(hiddenSubmit).to.not.be.null; // eslint-disable-line no-unused-expressions
45
43
  expect(el._nativeForm).to.not.be.null; // eslint-disable-line no-unused-expressions
@@ -50,15 +48,13 @@ describe('form', () => {
50
48
  await defaultChecks(el);
51
49
 
52
50
  const shadowRoot = el.shadowRoot;
53
- const form = shadowRoot.querySelector('.form');
54
- const slot = form.querySelector('slot');
51
+ const slot = shadowRoot.querySelector('slot');
55
52
  const hiddenSubmit = el.querySelector('input[hidden][type="submit"]');
56
53
 
57
54
  expect(el.type).to.equal('standard', '`type` property has default value `standard`');
58
55
  expect(el._submitButton.nodeName).to.equal('BUTTON', 'has submit button');
59
56
  expect(el._submitButton.type).to.equal('submit', 'has submit type button');
60
57
  expect(el._resetButton).to.equal(null, 'no `reset` button added');
61
- expect(form).to.not.be.null; // eslint-disable-line no-unused-expressions
62
58
  expect(slot).to.not.be.null; // eslint-disable-line no-unused-expressions
63
59
  expect(hiddenSubmit).to.not.be.null; // eslint-disable-line no-unused-expressions
64
60
  });
@@ -68,15 +64,13 @@ describe('form', () => {
68
64
  await defaultChecks(el);
69
65
 
70
66
  const shadowRoot = el.shadowRoot;
71
- const form = shadowRoot.querySelector('.form');
72
- const slot = form.querySelector('slot');
67
+ const slot = shadowRoot.querySelector('slot');
73
68
  const hiddenSubmit = el.querySelector('input[hidden][type="submit"]');
74
69
 
75
70
  expect(el.type).to.equal('standard', '`type` property has default value `standard`');
76
71
  expect(el._submitButton.nodeName.toLowerCase()).to.equal(ctaTagName, 'has submit cta');
77
72
  expect(el._submitButton.type).to.equal('submit', 'has submit type button');
78
73
  expect(el._resetButton).to.equal(null, 'no `reset` cta added');
79
- expect(form).to.not.be.null; // eslint-disable-line no-unused-expressions
80
74
  expect(slot).to.not.be.null; // eslint-disable-line no-unused-expressions
81
75
  expect(hiddenSubmit).to.not.be.null; // eslint-disable-line no-unused-expressions
82
76
  });
@@ -86,15 +80,13 @@ describe('form', () => {
86
80
  await defaultChecks(el);
87
81
 
88
82
  const shadowRoot = el.shadowRoot;
89
- const form = shadowRoot.querySelector('.form');
90
- const slot = form.querySelector('slot');
83
+ const slot = shadowRoot.querySelector('slot');
91
84
  const hiddenSubmit = el.querySelector('input[hidden][type="submit"]');
92
85
 
93
86
  expect(el.type).to.equal('standard', '`type` property has default value `standard`');
94
87
  expect(el._submitButton.nodeName).to.equal('INPUT', 'has submit input');
95
88
  expect(el._submitButton.type).to.equal('submit', 'has submit type input');
96
89
  expect(el._resetButton).to.equal(null, 'no `reset` button added');
97
- expect(form).to.not.be.null; // eslint-disable-line no-unused-expressions
98
90
  expect(slot).to.not.be.null; // eslint-disable-line no-unused-expressions
99
91
  expect(hiddenSubmit).to.not.be.null; // eslint-disable-line no-unused-expressions
100
92
  });
@@ -104,15 +96,13 @@ describe('form', () => {
104
96
  await defaultChecks(el);
105
97
 
106
98
  const shadowRoot = el.shadowRoot;
107
- const form = shadowRoot.querySelector('.form');
108
- const slot = form.querySelector('slot');
99
+ const slot = shadowRoot.querySelector('slot');
109
100
  const hiddenSubmit = el.querySelector('input[hidden][type="submit"]');
110
101
 
111
102
  expect(el.type).to.equal('standard', '`type` property has default value `standard`');
112
103
  expect(el._resetButton.nodeName).to.equal('BUTTON', 'has reset button');
113
104
  expect(el._resetButton.type).to.equal('reset', 'has reset type button');
114
105
  expect(el._submitButton).to.equal(null, 'no `submit` button added');
115
- expect(form).to.not.be.null; // eslint-disable-line no-unused-expressions
116
106
  expect(slot).to.not.be.null; // eslint-disable-line no-unused-expressions
117
107
  expect(hiddenSubmit).to.not.be.null; // eslint-disable-line no-unused-expressions
118
108
  });
@@ -122,15 +112,13 @@ describe('form', () => {
122
112
  await defaultChecks(el);
123
113
 
124
114
  const shadowRoot = el.shadowRoot;
125
- const form = shadowRoot.querySelector('.form');
126
- const slot = form.querySelector('slot');
115
+ const slot = shadowRoot.querySelector('slot');
127
116
  const hiddenSubmit = el.querySelector('input[hidden][type="submit"]');
128
117
 
129
118
  expect(el.type).to.equal('standard', '`type` property has default value `standard`');
130
119
  expect(el._resetButton.nodeName.toLowerCase()).to.equal(ctaTagName, 'has reset cta');
131
120
  expect(el._resetButton.type).to.equal('reset', 'has reset type button');
132
121
  expect(el._submitButton).to.equal(null, 'no `submit` cta added');
133
- expect(form).to.not.be.null; // eslint-disable-line no-unused-expressions
134
122
  expect(slot).to.not.be.null; // eslint-disable-line no-unused-expressions
135
123
  expect(hiddenSubmit).to.not.be.null; // eslint-disable-line no-unused-expressions
136
124
  });
@@ -140,15 +128,13 @@ describe('form', () => {
140
128
  await defaultChecks(el);
141
129
 
142
130
  const shadowRoot = el.shadowRoot;
143
- const form = shadowRoot.querySelector('.form');
144
- const slot = form.querySelector('slot');
131
+ const slot = shadowRoot.querySelector('slot');
145
132
  const hiddenSubmit = el.querySelector('input[hidden][type="submit"]');
146
133
 
147
134
  expect(el.type).to.equal('standard', '`type` property has default value `standard`');
148
135
  expect(el._resetButton.nodeName).to.equal('INPUT', 'has reset input');
149
136
  expect(el._resetButton.type).to.equal('reset', 'has reset type input');
150
137
  expect(el._submitButton).to.equal(null, 'no `submit` button added');
151
- expect(form).to.not.be.null; // eslint-disable-line no-unused-expressions
152
138
  expect(slot).to.not.be.null; // eslint-disable-line no-unused-expressions
153
139
  expect(hiddenSubmit).to.not.be.null; // eslint-disable-line no-unused-expressions
154
140
  });