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

Remove text knob from input-provider #1679

Merged
6 commits merged into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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