Skip to content

Commit d8b7fa0

Browse files
authored
Migrate test stories to CSF
1 parent 06e7c3c commit d8b7fa0

File tree

3 files changed

+84
-67
lines changed

3 files changed

+84
-67
lines changed

test/amp-base-carousel-1-0.stories.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/**
2+
* Copyright 2020 The AMP HTML Authors. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS-IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/** @jsx h */
18+
import { h } from 'preact';
19+
import { withAmp } from '../esm';
20+
import { text, withKnobs } from '@storybook/addon-knobs';
21+
22+
export default {
23+
title: 'amp-base-carousel-1.0',
24+
decorators: [withKnobs, withAmp],
25+
26+
parameters: {
27+
extensions: [{ name: 'amp-base-carousel', version: '1.0' }],
28+
experiments: ['bento'],
29+
},
30+
};
31+
32+
export const Default = () => {
33+
const slide1 = text('slide1', 'lightcoral');
34+
return (
35+
<amp-base-carousel width="440" height="225">
36+
{[slide1, 'peachpuff', 'lavender'].map((color) => (
37+
<div key={color}>{color}</div>
38+
))}
39+
</amp-base-carousel>
40+
);
41+
};
42+
43+
Default.story = {
44+
name: 'default',
45+
};
46+
47+
export const Other = () => {
48+
return (
49+
<amp-base-carousel width="440" height="225">
50+
{['peachpuff', 'lavender'].map((color) => (
51+
<div key={color}>{color}</div>
52+
))}
53+
</amp-base-carousel>
54+
);
55+
};
56+
57+
Other.story = {
58+
name: 'other',
59+
};

test/amp-script-0.1.stories.js renamed to test/amp-script-0-1.stories.js

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,31 @@
1515
*/
1616

1717
/** @jsx h */
18-
import { h } from "preact";
19-
import { storiesOf } from "@storybook/preact";
20-
import { withAmp } from "../esm";
21-
import { text, withKnobs } from "@storybook/addon-knobs";
18+
import { h } from 'preact';
19+
import { withAmp } from '../esm';
20+
import { withKnobs } from '@storybook/addon-knobs';
2221

23-
storiesOf("amp-script-0.1", module)
24-
.addDecorator(withKnobs)
25-
.addDecorator(withAmp)
26-
.addParameters({
27-
extensions: [{ name: "amp-script", version: "0.1" }],
28-
})
29-
.add("amp-script", () => (
30-
<div>
31-
Open console, see "amp-script executed".
32-
<amp-script id="dataFunctions" script="local-script" nodom></amp-script>
33-
<script id="local-script" type="text/plain" target="amp-script">
34-
{`
22+
export default {
23+
title: 'amp-script-0.1',
24+
decorators: [withKnobs, withAmp],
25+
26+
parameters: {
27+
extensions: [{ name: 'amp-script', version: '0.1' }],
28+
},
29+
};
30+
31+
export const AmpScript = () => (
32+
<div>
33+
Open console, see "amp-script executed".
34+
<amp-script id="dataFunctions" script="local-script" nodom></amp-script>
35+
<script id="local-script" type="text/plain" target="amp-script">
36+
{`
3537
console.log('amp-script executed');
3638
`}
37-
</script>
38-
</div>
39-
));
39+
</script>
40+
</div>
41+
);
42+
43+
AmpScript.story = {
44+
name: 'amp-script',
45+
};

test/base-carousel-1.0.stories.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)