-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(editor): Update and add design system checkbox component to Editor (
#6178) * fix(editor): Update and add design system checkbox component to Editor * test(editor): Test Checkbox design system component
- Loading branch information
Showing
5 changed files
with
194 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/design-system/src/components/N8nCheckbox/__tests__/Checkbox.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { render } from '@testing-library/vue'; | ||
import N8nCheckbox from '../Checkbox.vue'; | ||
|
||
describe('components', () => { | ||
describe('N8nCheckbox', () => { | ||
it('should render without label and child content', () => { | ||
const { container } = render(N8nCheckbox); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render with label', () => { | ||
const { container } = render(N8nCheckbox, { props: { label: 'Checkbox' } }); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render with child', () => { | ||
const { container } = render(N8nCheckbox, { | ||
slots: { default: '<strong>Bold text</strong>' }, | ||
}); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render with both child and label', () => { | ||
const { container } = render(N8nCheckbox, { | ||
props: { label: 'Checkbox' }, | ||
slots: { default: '<strong>Bold text</strong>' }, | ||
}); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
158 changes: 158 additions & 0 deletions
158
...es/design-system/src/components/N8nCheckbox/__tests__/__snapshots__/Checkbox.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`components > N8nCheckbox > should render with both child and label 1`] = ` | ||
<div> | ||
<label | ||
class="el-checkbox n8n-checkbox n8nCheckbox" | ||
labelsize="medium" | ||
> | ||
<span | ||
class="el-checkbox__input" | ||
> | ||
<span | ||
class="el-checkbox__inner" | ||
/> | ||
<input | ||
aria-hidden="false" | ||
class="el-checkbox__original" | ||
type="checkbox" | ||
value="Checkbox" | ||
/> | ||
</span> | ||
<span | ||
class="el-checkbox__label" | ||
> | ||
<strong> | ||
Bold text | ||
</strong> | ||
<div | ||
class="container" | ||
> | ||
<label | ||
class="n8n-input-label inputLabel heading medium" | ||
> | ||
<div | ||
class="title" | ||
> | ||
<span | ||
class="n8n-text size-medium regular" | ||
> | ||
Checkbox | ||
<!----> | ||
</span> | ||
</div> | ||
<!----> | ||
<!----> | ||
<!----> | ||
</label> | ||
</div> | ||
<!----> | ||
</span> | ||
</label> | ||
</div> | ||
`; | ||
|
||
exports[`components > N8nCheckbox > should render with child 1`] = ` | ||
<div> | ||
<label | ||
class="el-checkbox n8n-checkbox n8nCheckbox" | ||
labelsize="medium" | ||
> | ||
<span | ||
class="el-checkbox__input" | ||
> | ||
<span | ||
class="el-checkbox__inner" | ||
/> | ||
<input | ||
aria-hidden="false" | ||
class="el-checkbox__original" | ||
type="checkbox" | ||
value="" | ||
/> | ||
</span> | ||
<span | ||
class="el-checkbox__label" | ||
> | ||
<strong> | ||
Bold text | ||
</strong> | ||
<!----> | ||
<!----> | ||
</span> | ||
</label> | ||
</div> | ||
`; | ||
|
||
exports[`components > N8nCheckbox > should render with label 1`] = ` | ||
<div> | ||
<label | ||
class="el-checkbox n8n-checkbox n8nCheckbox" | ||
labelsize="medium" | ||
> | ||
<span | ||
class="el-checkbox__input" | ||
> | ||
<span | ||
class="el-checkbox__inner" | ||
/> | ||
<input | ||
aria-hidden="false" | ||
class="el-checkbox__original" | ||
type="checkbox" | ||
value="Checkbox" | ||
/> | ||
</span> | ||
<span | ||
class="el-checkbox__label" | ||
> | ||
<div | ||
class="container" | ||
> | ||
<label | ||
class="n8n-input-label inputLabel heading medium" | ||
> | ||
<div | ||
class="title" | ||
> | ||
<span | ||
class="n8n-text size-medium regular" | ||
> | ||
Checkbox | ||
<!----> | ||
</span> | ||
</div> | ||
<!----> | ||
<!----> | ||
<!----> | ||
</label> | ||
</div> | ||
<!----> | ||
</span> | ||
</label> | ||
</div> | ||
`; | ||
|
||
exports[`components > N8nCheckbox > should render without label and child content 1`] = ` | ||
<div> | ||
<label | ||
class="el-checkbox n8n-checkbox n8nCheckbox" | ||
labelsize="medium" | ||
> | ||
<span | ||
class="el-checkbox__input" | ||
> | ||
<span | ||
class="el-checkbox__inner" | ||
/> | ||
<input | ||
aria-hidden="false" | ||
class="el-checkbox__original" | ||
type="checkbox" | ||
value="" | ||
/> | ||
</span> | ||
<!----> | ||
</label> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters