Skip to content

Commit

Permalink
Merge 3e83aed into 022b56f
Browse files Browse the repository at this point in the history
  • Loading branch information
montoya332 authored Oct 31, 2023
2 parents 022b56f + 3e83aed commit 925c68c
Show file tree
Hide file tree
Showing 68 changed files with 4,126 additions and 7,894 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
config.resolve.extensions.push('.ts', '.tsx')

// Remove storybook css predefined webpack rule and use custom rule
config.module.rules = config.module.rules.filter(rule => !rule.test.test('.css'))
config.module.rules = config.module.rules.filter(rule => !rule?.test?.test?.('.css'))
config.module.rules.push({
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }]
Expand Down
10 changes: 6 additions & 4 deletions src/ebay-breadcrumbs/__tests__/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import requireContext from 'node-require-context'
import { render } from '@testing-library/react'
import { initStoryshots } from '../../../config/jest/storyshots'

Expand Down Expand Up @@ -41,8 +42,9 @@ describe('<EbayBreadcrumbs>', () => {
})

initStoryshots({
config: ({ configure }) =>
configure(() => {
require('./index.stories')
}, module)
config: ({ configure }) => {
const req = requireContext('./', false, /\.stories\.tsx$/);
return configure(req, module)
}

})
87 changes: 68 additions & 19 deletions src/ebay-breadcrumbs/__tests__/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,85 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import { action } from '../../../.storybook/action'

import { EbayBreadcrumbs, EbayBreadcrumbItem as Item } from '../index'

storiesOf('ebay-breadcrumb', module)
.add('default', () => (<>
export default {
title: 'ebay-breadcrumb'
}

export const Default = () => (
<>
<EbayBreadcrumbs onSelect={(e, { el }) => action('select')(e, { el })}>
<Item href="https://www.ebay.com/">eBay</Item>
<Item href="https://www.ebay.com/rpp/cell-phone-pda">Cell Phones, Smart Watches & Accessories</Item>
<Item href="https://www.ebay.com/b/Smart-Watch-Accessories/182064/bn_16565905">Smart Watch Accessories</Item>
<Item href="https://www.ebay.com/rpp/cell-phone-pda">
Cell Phones, Smart Watches & Accessories
</Item>
<Item href="https://www.ebay.com/b/Smart-Watch-Accessories/182064/bn_16565905">
Smart Watch Accessories
</Item>
<Item>Smart Watch Bands</Item>
</EbayBreadcrumbs>
</>))
.add('all links', () => (<>
</>
)

Default.story = {
name: 'default'
}

export const AllLinks = () => (
<>
<EbayBreadcrumbs a11yHeadingText="Custom page navigation" a11yHeadingTag="h3">
<Item href="https://www.ebay.com/">eBay</Item>
<Item href="https://www.ebay.com/rpp/cell-phone-pda">Cell Phones, Smart Watches & Accessories</Item>
<Item href="https://www.ebay.com/b/Smart-Watch-Accessories/182064/bn_16565905">Smart Watch Accessories</Item>
<Item href="https://www.ebay.com/b/Smart-Watch-Bands/182068/bn_16565906">Smart Watch Bands</Item>
<Item href="https://www.ebay.com/rpp/cell-phone-pda">
Cell Phones, Smart Watches & Accessories
</Item>
<Item href="https://www.ebay.com/b/Smart-Watch-Accessories/182064/bn_16565905">
Smart Watch Accessories
</Item>
<Item href="https://www.ebay.com/b/Smart-Watch-Bands/182068/bn_16565906">
Smart Watch Bands
</Item>
</EbayBreadcrumbs>
</>))
.add('custom props', () => (<>
</>
)

AllLinks.story = {
name: 'all links'
}

export const CustomProps = () => (
<>
<EbayBreadcrumbs className="custom-breadcrumbs" custom-attr="value">
<Item href="http://www.ebay.com/" navsrc="{}" _sp="p2345.m909.l34" data-track="123">
eBay
</Item>
<Item href="https://www.ebay.com/rpp/cell-phone-pda" navsrc="{}" _sp="p2345.m909.l34" data-track="456">
<Item
href="https://www.ebay.com/rpp/cell-phone-pda"
navsrc="{}"
_sp="p2345.m909.l34"
data-track="456"
>
Cell Phones, Smart Watches & Accessories
</Item>
<Item href="https://www.ebay.com/b/Smart-Watch-Accessories/182064/bn_16565905" navsrc="{}" _sp="p2345.m909.l34" data-track="789">
<Item
href="https://www.ebay.com/b/Smart-Watch-Accessories/182064/bn_16565905"
navsrc="{}"
_sp="p2345.m909.l34"
data-track="789"
>
Smart Watch Accessories
</Item>
<Item>Smart Watch Bands</Item>
</EbayBreadcrumbs>
</>))
.add('all buttons', () => (<>
</>
)

CustomProps.story = {
name: 'custom props'
}

export const AllButtons = () => (
<>
<EbayBreadcrumbs
a11yHeadingText="Custom page navigation"
a11yHeadingTag="h3"
Expand All @@ -46,8 +90,13 @@ storiesOf('ebay-breadcrumb', module)
'Cell Phones, Smart Watches & Accessories',
'Smart Watch Accessories',
'Smart Watch Bands'
].map((item, index) =>
].map((item, index) => (
<Item key={index}>{item}</Item>
)}
))}
</EbayBreadcrumbs>
</>))
</>
)

AllButtons.story = {
name: 'all buttons'
}
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,6 @@ exports[`Storyshots ebay-button Split button 1`] = `
</svg>
</button>
</p>
</DocumentFragment>
`;

Expand Down
11 changes: 7 additions & 4 deletions src/ebay-button/__tests__/index.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import React from 'react'
import requireContext from 'node-require-context'

import { fireEvent, render } from '@testing-library/react'
import { initStoryshots } from '../../../config/jest/storyshots'
import { EbayButton } from '../index'

const anySyntheticEvent = expect.objectContaining( { target: null })

initStoryshots({
config: ({ configure }) =>
configure(() => {
require('./index.stories')
}, module)
config: ({ configure }) => {
const req = requireContext('./', false, /\.stories\.tsx$/);
return configure(req, module)
}

})

describe('<EbayButton>', () => {
Expand Down
Loading

0 comments on commit 925c68c

Please sign in to comment.