Skip to content

Commit

Permalink
feat(mon-pix): add module expand element
Browse files Browse the repository at this point in the history
Co-authored-by: Diane Cordier <[email protected]>
  • Loading branch information
dianeCdrPix authored and clemlatz committed Dec 20, 2024
1 parent fa5773b commit 419bb81
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mon-pix/app/components/module/element/expand.gjs
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 mon-pix/tests/integration/components/module/expand_test.gjs
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();
});
});

0 comments on commit 419bb81

Please sign in to comment.