-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'type=module' into type=module-headless-types
- Loading branch information
Showing
66 changed files
with
548 additions
and
203 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
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
4 changes: 0 additions & 4 deletions
4
...atomic/src/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.pcss
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 |
---|---|---|
@@ -1,5 +1 @@ | ||
@import '../../search/atomic-search-box/atomic-search-box.pcss'; | ||
|
||
:host { | ||
@apply relative z-10; | ||
} |
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
65 changes: 65 additions & 0 deletions
65
...e/product-template-components/atomic-product-rating/atomic-product-rating.new.stories.tsx
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,65 @@ | ||
import type {Meta, StoryObj as Story} from '@storybook/web-components'; | ||
import {wrapInCommerceInterface} from '../../../../../storybookUtils/commerce/commerce-interface-wrapper'; | ||
import {wrapInCommerceProductList} from '../../../../../storybookUtils/commerce/commerce-product-list-wrapper'; | ||
import {wrapInProductTemplate} from '../../../../../storybookUtils/commerce/commerce-product-template-wrapper'; | ||
import {parameters} from '../../../../../storybookUtils/common/common-meta-parameters'; | ||
import {renderComponent} from '../../../../../storybookUtils/common/render-component'; | ||
|
||
const { | ||
decorator: commerceInterfaceDecorator, | ||
play: initializeCommerceInterface, | ||
} = wrapInCommerceInterface({ | ||
skipFirstSearch: false, | ||
type: 'product-listing', | ||
engineConfig: { | ||
context: { | ||
view: { | ||
url: 'https://sports.barca.group/browse/promotions/ui-kit-testing', | ||
}, | ||
language: 'en', | ||
country: 'US', | ||
currency: 'USD', | ||
}, | ||
}, | ||
}); | ||
const {decorator: commerceProductListDecorator} = wrapInCommerceProductList(); | ||
const {decorator: productTemplateDecorator} = wrapInProductTemplate(); | ||
|
||
const meta: Meta = { | ||
component: 'atomic-product-rating', | ||
title: 'Atomic-Commerce/Product Template Components/ProductRating', | ||
id: 'atomic-product-rating', | ||
render: renderComponent, | ||
decorators: [ | ||
productTemplateDecorator, | ||
commerceProductListDecorator, | ||
commerceInterfaceDecorator, | ||
], | ||
parameters, | ||
play: initializeCommerceInterface, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: Story = { | ||
name: 'atomic-product-rating', | ||
}; | ||
|
||
export const WithARatingDetailsField: Story = { | ||
args: { | ||
'attributes-rating-details-field': 'ec_rating', | ||
}, | ||
}; | ||
|
||
export const WithAMaxValueInIndex: Story = { | ||
args: { | ||
'attributes-max-value-in-index': 10, | ||
}, | ||
}; | ||
|
||
export const WithADifferentIcon: Story = { | ||
args: { | ||
'attributes-icon': | ||
'https://raw.githubusercontent.com/Rush/Font-Awesome-SVG-PNG/master/black/svg/circle.svg', | ||
}, | ||
}; |
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
82 changes: 82 additions & 0 deletions
82
...mmerce/product-template-components/atomic-product-rating/e2e/atomic-product-rating.e2e.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,82 @@ | ||
import {test, expect} from './fixture'; | ||
|
||
test.describe('default', () => { | ||
test.beforeEach(async ({productRating}) => { | ||
await productRating.load(); | ||
}); | ||
|
||
test('should be accessible', async ({productRating, makeAxeBuilder}) => { | ||
await expect(productRating.hydrated.first()).toBeVisible(); | ||
|
||
expect((await makeAxeBuilder().analyze()).violations.length).toBe(0); | ||
}); | ||
|
||
test('should have the right number of yellow icons', async ({ | ||
productRating, | ||
}) => { | ||
await expect(productRating.blueLagoonYellowIcons).toHaveAttribute( | ||
'style', | ||
'width: 80%;' | ||
); | ||
}); | ||
}); | ||
|
||
test.describe('with a rating details field', () => { | ||
test.beforeEach(async ({productRating}) => { | ||
await productRating.load({story: 'with-a-rating-details-field'}); | ||
}); | ||
|
||
test('should be accessible', async ({productRating, makeAxeBuilder}) => { | ||
await expect(productRating.hydrated.first()).toBeVisible(); | ||
|
||
expect((await makeAxeBuilder().analyze()).violations.length).toBe(0); | ||
}); | ||
|
||
test('should show the rating details next to the rating', async ({ | ||
productRating, | ||
}) => { | ||
await expect(productRating.hydrated.first().getByText('4')).toBeVisible(); | ||
}); | ||
}); | ||
|
||
test.describe('with a max value in index of 10', () => { | ||
test.beforeEach(async ({productRating}) => { | ||
await productRating.load({story: 'with-a-max-value-in-index'}); | ||
}); | ||
|
||
test('should be accessible', async ({productRating, makeAxeBuilder}) => { | ||
await expect(productRating.hydrated.first()).toBeVisible(); | ||
|
||
expect((await makeAxeBuilder().analyze()).violations.length).toBe(0); | ||
}); | ||
|
||
test('should have the right number of yellow icons', async ({ | ||
productRating, | ||
}) => { | ||
await expect(productRating.blueLagoonYellowIcons).toHaveAttribute( | ||
'style', | ||
'width: 40%;' | ||
); | ||
}); | ||
}); | ||
|
||
test.describe('with a different icon', () => { | ||
test.beforeEach(async ({productRating}) => { | ||
await productRating.load({story: 'with-a-different-icon'}); | ||
}); | ||
|
||
test('should be accessible', async ({productRating, makeAxeBuilder}) => { | ||
await expect(productRating.hydrated.first()).toBeVisible(); | ||
|
||
expect((await makeAxeBuilder().analyze()).violations.length).toBe(0); | ||
}); | ||
|
||
test('should have the right number of yellow icons', async ({ | ||
productRating, | ||
}) => { | ||
await expect(productRating.blueLagoonYellowIcons).toHaveAttribute( | ||
'style', | ||
'width: 80%;' | ||
); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
.../src/components/commerce/product-template-components/atomic-product-rating/e2e/fixture.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,19 @@ | ||
import {test as base} from '@playwright/test'; | ||
import { | ||
makeAxeBuilder, | ||
AxeFixture, | ||
} from '../../../../../../playwright-utils/base-fixture'; | ||
import {ProductRatingPageObject} from './page-object'; | ||
|
||
type MyFixtures = { | ||
productRating: ProductRatingPageObject; | ||
}; | ||
|
||
export const test = base.extend<MyFixtures & AxeFixture>({ | ||
makeAxeBuilder, | ||
productRating: async ({page}, use) => { | ||
await use(new ProductRatingPageObject(page)); | ||
}, | ||
}); | ||
|
||
export {expect} from '@playwright/test'; |
15 changes: 15 additions & 0 deletions
15
.../components/commerce/product-template-components/atomic-product-rating/e2e/page-object.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,15 @@ | ||
import {Page} from '@playwright/test'; | ||
import {BasePageObject} from '../../../../../../playwright-utils/base-page-object'; | ||
|
||
export class ProductRatingPageObject extends BasePageObject<'atomic-product-rating'> { | ||
constructor(page: Page) { | ||
super(page, 'atomic-product-rating'); | ||
} | ||
|
||
get blueLagoonYellowIcons() { | ||
return this.page | ||
.getByLabel('4 stars out of', {exact: false}) | ||
.locator('div') | ||
.nth(1); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,6 @@ | |
} | ||
} | ||
|
||
:host([textarea]) { | ||
:host { | ||
@apply relative z-10; | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.