-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mon-pix): add module expand element
Co-authored-by: Diane Cordier <[email protected]>
- Loading branch information
1 parent
fa5773b
commit 419bb81
Showing
2 changed files
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { htmlUnsafe } from '../../../helpers/html-unsafe'; | ||
|
||
<template> | ||
<details> | ||
<summary>{{@expand.title}}</summary> | ||
{{htmlUnsafe @expand.content}} | ||
</details> | ||
</template> |
27 changes: 27 additions & 0 deletions
27
mon-pix/tests/integration/components/module/expand_test.gjs
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,27 @@ | ||
import { render } from '@1024pix/ember-testing-library'; | ||
import ModulixExpandElement from 'mon-pix/components/module/element/expand'; | ||
import { module, test } from 'qunit'; | ||
|
||
import setupIntlRenderingTest from '../../../helpers/setup-intl-rendering'; | ||
|
||
module('Integration | Component | Module | Expand', function (hooks) { | ||
setupIntlRenderingTest(hooks); | ||
|
||
test('should display the title of an expand', async function (assert) { | ||
// given | ||
const content = 'My content'; | ||
const expandElement = { | ||
title: 'Expand title', | ||
content: `<p>${content}</p>`, | ||
}; | ||
|
||
// when | ||
const screen = await render(<template><ModulixExpandElement @expand={{expandElement}} /></template>); | ||
|
||
// then | ||
const detailsElement = screen.getByRole('group'); | ||
assert.dom(detailsElement).exists(); | ||
assert.dom(screen.getByText(expandElement.title)).exists(); | ||
assert.dom(screen.getByText(content)).exists(); | ||
}); | ||
}); |