Skip to content

Commit

Permalink
feat(doc): fix message e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: aurore.stagnol <[email protected]>
  • Loading branch information
astagnol authored and dpellier committed Dec 18, 2023
1 parent 2bba058 commit 1dabcb2
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 275 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('e2e:osds-message', () => {
expect(await el.getProperty('type')).toBe(ODS_MESSAGE_TYPE.success);
expect(await el.getProperty('color')).toBe(ODS_THEME_COLOR_INTENT.success);

const icon = await (await page.find('osds-message >>> .message__wrapper')).find('osds-icon');
const icon = await (await page.find('osds-message >>> .message_wrapper')).find('osds-icon');
expect(icon.getAttribute('name')).toBe(ODS_ICON_NAME.SUCCESS_CIRCLE);
});

Expand All @@ -52,7 +52,7 @@ describe('e2e:osds-message', () => {
expect(await el.getProperty('type')).toBe(ODS_MESSAGE_TYPE.info);
expect(await el.getProperty('color')).toBe(ODS_THEME_COLOR_INTENT.info);

const icon = await (await page.find('osds-message >>> .message__wrapper')).find('osds-icon');
const icon = await (await page.find('osds-message >>> .message_wrapper')).find('osds-icon');
expect(icon.getAttribute('name')).toBe(ODS_ICON_NAME.INFO_CIRCLE);
});

Expand All @@ -61,7 +61,7 @@ describe('e2e:osds-message', () => {
expect(await el.getProperty('type')).toBe(ODS_MESSAGE_TYPE.warning);
expect(await el.getProperty('color')).toBe(ODS_THEME_COLOR_INTENT.warning);

const icon = await (await page.find('osds-message >>> .message__wrapper')).find('osds-icon');
const icon = await (await page.find('osds-message >>> .message_wrapper')).find('osds-icon');
expect(icon.getAttribute('name')).toBe(ODS_ICON_NAME.WARNING_CIRCLE);
});

Expand All @@ -70,7 +70,7 @@ describe('e2e:osds-message', () => {
expect(await el.getProperty('type')).toBe(ODS_MESSAGE_TYPE.error);
expect(await el.getProperty('color')).toBe(ODS_THEME_COLOR_INTENT.error);

const icon = await (await page.find('osds-message >>> .message__wrapper')).find('osds-icon');
const icon = await (await page.find('osds-message >>> .message_wrapper')).find('osds-icon');
expect(icon.getAttribute('name')).toBe(ODS_ICON_NAME.ERROR_CIRCLE);
});
});
Expand All @@ -80,7 +80,7 @@ describe('e2e:osds-message', () => {
await setup({ attributes: { removable: true } });
expect(await el.getProperty('removable')).toBe(true);

const icon = await (await page.find('osds-message >>> .message__close-wrapper')).find('osds-icon');
const icon = await (await page.find('osds-message >>> .message_close-wrapper')).find('osds-icon');
expect(icon.getAttribute('name')).toBe(ODS_ICON_NAME.CLOSE);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const Template = (args: any) => {
#alignment {
display: flex;
height: 100vh;
flex-wrap: wrap;
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

42 changes: 42 additions & 0 deletions packages/storybook/stories/components/menu/3_demo.stories.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { defineCustomElement } from '@ovhcloud/ods-components/dist/components/osds-menu';
import { html } from 'lit-html';
import { extractArgTypes, extractStoryParams } from '../../../core/componentHTMLUtils';
import { applyContentText, positionParams } from '../../../core/commonPositionStoryParams';
import { styleMap } from 'lit-html/directives/style-map';


defineCustomElement();

Expand Down Expand Up @@ -34,3 +38,41 @@ const TemplateDemo = () => html`
</osds-menu>
`;
export const Demo = TemplateDemo.bind({});

/* Position */
const TemplatePosition = ({ ...args }) => {
return html`
<style>
#alignment {
display: flex;
height: 100vh;
flex-wrap: wrap;
}
</style>
<div id='alignment' style=${styleMap({ placeContent: args.changeAlignment })}>
<p>${args.applyContent ? applyContentText : ''}</p>
<osds-menu>
<osds-button slot='menu-title' color='primary' variant='stroked'>Action menu <osds-icon name='home' size='xs'></osds-icon></osds-button>
<osds-menu-group>
<osds-text>Group/Text 1</osds-text>
</osds-menu-group>
<osds-menu-item>
<osds-button color='primary' size='sm' variant='ghost' text-align='start' flex><span>Action 1</span></osds-button>
</osds-menu-item>
<osds-menu-item>
<osds-button color='primary' size='sm' variant='ghost' text-align='start' flex><span>Action 2</span></osds-button>
</osds-menu-item>
</osds-menu>
<p>${args.applyContent ? applyContentText : ''}</p>
</div>
`;
}

export const Position = TemplatePosition.bind({});
// @ts-ignore
Position.args = {
...extractStoryParams(positionParams),
};
// @ts-ignore
Position.argTypes = extractArgTypes(positionParams);

0 comments on commit 1dabcb2

Please sign in to comment.