Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1679 from bbc/input-provider-bug
Browse files Browse the repository at this point in the history
Remove text knob from input-provider
  • Loading branch information
sadickisaac authored Aug 9, 2019
2 parents d84e4b6 + b389a45 commit 2cb09d1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
1 change: 1 addition & 0 deletions packages/utilities/psammead-storybook-helpers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
|---------|-------------|
| 4.0.0 | [PR#1679](https://github.com/bbc/psammead/pull/1679) Remove text knob from input-provider |
| 3.3.4 | [PR#1685](https://github.com/bbc/psammead/pull/1685) Bump dependencies |
| 3.3.3 | [PR#1682](https://github.com/bbc/psammead/pull/1682) Move all dev dependencies to top level package.json |
| 3.3.2 | [PR#1595](https://github.com/bbc/psammead/pull/1595) Bump `@bbc/gel-foundations` |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/utilities/psammead-storybook-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-storybook-helpers",
"version": "3.3.4",
"version": "4.0.0",
"main": "dist/index.js",
"module": "esm/index.js",
"sideEffects": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ describe('Psammead storybook helpers', () => {
});

expect(select).toHaveBeenCalledTimes(1);
expect(text).toHaveBeenCalledTimes(1);
});

it('for multiple slots', () => {
Expand All @@ -159,7 +158,6 @@ describe('Psammead storybook helpers', () => {
});

expect(select).toHaveBeenCalledTimes(1);
expect(text).toHaveBeenCalledTimes(2);
});
});

Expand All @@ -179,7 +177,6 @@ describe('Psammead storybook helpers', () => {
});

expect(select).toHaveBeenCalledTimes(1);
expect(text).toHaveBeenCalledTimes(1);
});

it('defaults to service text for non-news services', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from 'react';
import { text, select } from '@storybook/addon-knobs';
import { select } from '@storybook/addon-knobs';
import { Helmet } from 'react-helmet';
import * as scripts from '@bbc/gel-foundations/scripts';
import LANGUAGE_VARIANTS from './text-variants';
Expand All @@ -16,18 +16,15 @@ const inputProvider = (slots, componentFunction, services) => () => {
const service = LANGUAGE_VARIANTS[serviceName];
const isNews = serviceName === 'news';

const slotTexts = (slots || []).map(({ name, defaultText }) =>
text(
`Content for ${name}`,
// Expect defaultText to be in English. When it is provided and we're
// displaying English language on the story, set the default text for
// this knob to defaultText.
// When we switch to a language other than English, set the default
// text for the knob to the snippet from LANGUAGE_VARIANTS for that
// language.
defaultText && isNews ? defaultText : service.text,
),
);
const slotTexts = (slots || []).map(({ defaultText }) => {
// Expect defaultText to be in English. When it is provided and we're
// displaying English language on the story, set the default text for
// this knob to defaultText.
// When we switch to a language other than English, set the
// text for the slot to the snippet from LANGUAGE_VARIANTS for that
// language.
return defaultText && isNews ? defaultText : service.text;
});

const script = scripts[service.script];
const dir = service.dir || 'ltr';
Expand Down

0 comments on commit 2cb09d1

Please sign in to comment.