Skip to content

Commit

Permalink
Use the list of skipped components in the Storyshot setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Oct 25, 2019
1 parent 2954d4f commit 9e4bcb8
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/clipboard-button/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useState } from '@wordpress/element';
*/
import ClipboardButton from '../';

export default { title: 'ClipboardButton(DontTest)', component: ClipboardButton };
export default { title: 'ClipboardButton', component: ClipboardButton };

const ClipboardButtonWithState = ( { copied, ...props } ) => {
const [ isCopied, setCopied ] = useState( copied );
Expand Down
207 changes: 207 additions & 0 deletions packages/components/storybook/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,194 @@ exports[`@wordpress/components ColorIndicator Default 1`] = `
/>
`;

exports[`@wordpress/components ColorPalette Default 1`] = `
<div
className="components-circular-option-picker"
>
<div
className="components-circular-option-picker__option-wrapper"
>
<button
aria-label="Color: red"
aria-pressed={false}
className="components-circular-option-picker__option"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"color": "#f00",
}
}
type="button"
/>
</div>
<div
className="components-circular-option-picker__option-wrapper"
>
<button
aria-label="Color: white"
aria-pressed={false}
className="components-circular-option-picker__option"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"color": "#fff",
}
}
type="button"
/>
</div>
<div
className="components-circular-option-picker__option-wrapper"
>
<button
aria-label="Color: blue"
aria-pressed={false}
className="components-circular-option-picker__option"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"color": "#00f",
}
}
type="button"
/>
</div>
<div
className="components-circular-option-picker__custom-clear-wrapper"
>
<div
className="components-circular-option-picker__dropdown-link-action"
>
<button
aria-expanded={false}
aria-label="Custom color picker"
className="components-button is-link"
onClick={[Function]}
type="button"
>
Custom Color
</button>
</div>
<button
className="components-button components-circular-option-picker__clear is-button is-default is-small"
onClick={[Function]}
type="button"
>
Clear
</button>
</div>
</div>
`;

exports[`@wordpress/components ColorPalette With Knobs 1`] = `
<div
className="components-circular-option-picker"
>
<div
className="components-circular-option-picker__option-wrapper"
>
<button
aria-label="Color: red"
aria-pressed={false}
className="components-circular-option-picker__option"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"color": "#f00",
}
}
type="button"
/>
</div>
<div
className="components-circular-option-picker__option-wrapper"
>
<button
aria-label="Color: white"
aria-pressed={false}
className="components-circular-option-picker__option"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"color": "#fff",
}
}
type="button"
/>
</div>
<div
className="components-circular-option-picker__option-wrapper"
>
<button
aria-label="Color: blue"
aria-pressed={false}
className="components-circular-option-picker__option"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"color": "#00f",
}
}
type="button"
/>
</div>
<div
className="components-circular-option-picker__custom-clear-wrapper"
>
<div
className="components-circular-option-picker__dropdown-link-action"
>
<button
aria-expanded={false}
aria-label="Custom color picker"
className="components-button is-link"
onClick={[Function]}
type="button"
>
Custom Color
</button>
</div>
<button
className="components-button components-circular-option-picker__clear is-button is-default is-small"
onClick={[Function]}
type="button"
>
Clear
</button>
</div>
</div>
`;

exports[`@wordpress/components Dashicon Default 1`] = `
<svg
aria-hidden="true"
Expand Down Expand Up @@ -1134,3 +1322,22 @@ exports[`@wordpress/components ScrollLock Default 1`] = `
</div>
</div>
`;

exports[`@wordpress/components VisuallyHidden Default 1`] = `
Array [
<div
className="components-visually-hidden"
>
This should not show.
</div>,
<div>
This text will
<span
className="components-visually-hidden"
>
but not inline
</span>
always show.
</div>,
]
`;
14 changes: 13 additions & 1 deletion packages/components/storybook/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
import initStoryshots from '@storybook/addon-storyshots';
import path from 'path';

/**
* The list of components that should be skipped because they
* don't work with the default Storyshots setup.
*
* @type {string[]}
*/
const skippedComponents = [
'ClipboardButton',
];

initStoryshots( {
configPath: path.resolve( __dirname, '../' ),
suite: '@wordpress/components',
storyKindRegex: /^((?!.*?DontTest).)*$/,
storyKindRegex: new RegExp(
`^((?!${ skippedComponents.join( '|' ) }).)*$`
),
} );

0 comments on commit 9e4bcb8

Please sign in to comment.