mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-28 05:10:17 +08:00
Merge pull request #2861 from storybooks/tmeasday/fix-knobs-test
Use UTC timezone in formatting too for knobs test
This commit is contained in:
commit
4ea7273f67
@ -130,7 +130,7 @@ storiesOf('Addons|Knobs.withKnobsOptions', module)
|
||||
const intro = `My name is ${name}, I'm ${age} years old, and my favorite fruit is ${fruit}.`;
|
||||
const style = { backgroundColor, ...otherStyles };
|
||||
const salutation = nice ? 'Nice to meet you!' : 'Leave me alone!';
|
||||
const dateOptions = { year: 'numeric', month: 'long', day: 'numeric' };
|
||||
const dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
|
@ -79,20 +79,21 @@ storiesOf('Advanced/Addon Knobs', module)
|
||||
const fruit = select('Fruit', fruits, 'apple');
|
||||
const price = number('Price', 2.25);
|
||||
const colour = color('Border', 'deeppink');
|
||||
const today = date('Today', new Date('Jan 20 2017'));
|
||||
const today = date('Today', new Date('Jan 20 2017 GMT+0'));
|
||||
const items = array('Items', ['Laptop', 'Book', 'Whiskey']);
|
||||
const nice = boolean('Nice', true);
|
||||
|
||||
const stockMessage = stock
|
||||
? `I have a stock of ${stock} ${fruit}, costing $${price} each.`
|
||||
: `I'm out of ${fruit}${nice ? ', Sorry!' : '.'}`;
|
||||
const dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };
|
||||
|
||||
button('Arbitrary action', action('You clicked it!'));
|
||||
|
||||
return `
|
||||
<div style="border:2px dotted ${colour}; padding: 8px 22px; border-radius: 8px">
|
||||
<h1>My name is ${name},</h1>
|
||||
<h3>today is ${new Date(today).toLocaleDateString()}</h3>
|
||||
<h3>today is ${new Date(today).toLocaleDateString('en-US', dateOptions)}</h3>
|
||||
<p>${stockMessage}</p>
|
||||
<p>Also, I have:</p>
|
||||
<ul>
|
||||
|
@ -27,7 +27,7 @@ exports[`Storyshots Addon Knobs All knobs 1`] = `
|
||||
</h1>
|
||||
|
||||
<h3>
|
||||
today is 2017-1-20
|
||||
today is January 20, 2017
|
||||
</h3>
|
||||
|
||||
<p>
|
||||
|
@ -223,7 +223,7 @@ storiesOf('Addon Knobs', module)
|
||||
const price = number('Price', 2.25);
|
||||
|
||||
const colour = color('Border', 'deeppink');
|
||||
const today = date('Today', new Date('Jan 20 2017'));
|
||||
const today = date('Today', new Date('Jan 20 2017 GMT+0'));
|
||||
const items = array('Items', ['Laptop', 'Book', 'Whiskey']);
|
||||
const nice = boolean('Nice', true);
|
||||
|
||||
@ -231,6 +231,8 @@ storiesOf('Addon Knobs', module)
|
||||
? `I have a stock of ${stock} ${fruit}, costing $${price} each.`
|
||||
: `I'm out of ${fruit}${nice ? ', Sorry!' : '.'}`;
|
||||
const salutation = nice ? 'Nice to meet you!' : 'Leave me alone!';
|
||||
const dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };
|
||||
|
||||
|
||||
button('Arbitrary action', action('You clicked it!'));
|
||||
|
||||
@ -238,7 +240,7 @@ storiesOf('Addon Knobs', module)
|
||||
template: `
|
||||
<div style="border:2px dotted ${colour}; padding: 8px 22px; border-radius: 8px">
|
||||
<h1>My name is ${name},</h1>
|
||||
<h3>today is ${new Date(today).toLocaleDateString()}</h3>
|
||||
<h3>today is ${new Date(today).toLocaleDateString('en-US', dateOptions)}</h3>
|
||||
<p>${stockMessage}</p>
|
||||
<p>Also, I have:</p>
|
||||
<ul>
|
||||
|
Loading…
x
Reference in New Issue
Block a user