From e62cb107c0368d9373f1ea0bc0f3ef211b0f75d8 Mon Sep 17 00:00:00 2001 From: sadickisaac Date: Thu, 8 Aug 2019 11:19:35 +0300 Subject: [PATCH 1/4] Remove text knob from input-provider --- .../src/index.test.jsx | 3 --- .../src/input-provider.jsx | 23 ++++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/packages/utilities/psammead-storybook-helpers/src/index.test.jsx b/packages/utilities/psammead-storybook-helpers/src/index.test.jsx index e8310b2ab1..1fbecc8775 100644 --- a/packages/utilities/psammead-storybook-helpers/src/index.test.jsx +++ b/packages/utilities/psammead-storybook-helpers/src/index.test.jsx @@ -134,7 +134,6 @@ describe('Psammead storybook helpers', () => { }); expect(select).toHaveBeenCalledTimes(1); - expect(text).toHaveBeenCalledTimes(1); }); it('for multiple slots', () => { @@ -159,7 +158,6 @@ describe('Psammead storybook helpers', () => { }); expect(select).toHaveBeenCalledTimes(1); - expect(text).toHaveBeenCalledTimes(2); }); }); @@ -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', () => { diff --git a/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx b/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx index 01c871989c..fec25a55f2 100644 --- a/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx +++ b/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx @@ -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'; @@ -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 default + // text for the knob 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'; From ed82b9168a4cf97f9bca9bab679f65fc1f8bf6d7 Mon Sep 17 00:00:00 2001 From: sadickisaac Date: Thu, 8 Aug 2019 11:28:02 +0300 Subject: [PATCH 2/4] Update PR number --- packages/utilities/psammead-storybook-helpers/CHANGELOG.md | 1 + packages/utilities/psammead-storybook-helpers/package-lock.json | 2 +- packages/utilities/psammead-storybook-helpers/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/utilities/psammead-storybook-helpers/CHANGELOG.md b/packages/utilities/psammead-storybook-helpers/CHANGELOG.md index 7ad64d6544..720c06f976 100644 --- a/packages/utilities/psammead-storybook-helpers/CHANGELOG.md +++ b/packages/utilities/psammead-storybook-helpers/CHANGELOG.md @@ -3,6 +3,7 @@ | Version | Description | |---------|-------------| +| 4.0.0 | [PR#1679](https://github.com/bbc/psammead/pull/1679) Remove text knob from input-provider | | 3.3.2 | [PR#1595](https://github.com/bbc/psammead/pull/1595) Bump `@bbc/gel-foundations` | | 3.3.1 | [PR#1479](https://github.com/bbc/psammead/pull/1479) Import all scripts from gel-foundations | | 3.3.0 | [PR#1233](https://github.com/bbc/psammead/pull/1233) Add ESM modules entry | diff --git a/packages/utilities/psammead-storybook-helpers/package-lock.json b/packages/utilities/psammead-storybook-helpers/package-lock.json index df76cd63d7..cca8cf6869 100644 --- a/packages/utilities/psammead-storybook-helpers/package-lock.json +++ b/packages/utilities/psammead-storybook-helpers/package-lock.json @@ -1,6 +1,6 @@ { "name": "@bbc/psammead-storybook-helpers", - "version": "3.3.2", + "version": "4.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/utilities/psammead-storybook-helpers/package.json b/packages/utilities/psammead-storybook-helpers/package.json index 755ddd978e..a488097376 100644 --- a/packages/utilities/psammead-storybook-helpers/package.json +++ b/packages/utilities/psammead-storybook-helpers/package.json @@ -1,6 +1,6 @@ { "name": "@bbc/psammead-storybook-helpers", - "version": "3.3.2", + "version": "4.0.0", "main": "dist/index.js", "module": "esm/index.js", "sideEffects": false, From 9952d02d4e1edc594c4a078efb380b8d2dcd3503 Mon Sep 17 00:00:00 2001 From: sadickisaac <48688870+sadickisaac@users.noreply.github.com> Date: Thu, 8 Aug 2019 15:21:10 +0300 Subject: [PATCH 3/4] Update packages/utilities/psammead-storybook-helpers/src/input-provider.jsx Co-Authored-By: Andrew Nowak <10963046+aacn500@users.noreply.github.com> --- .../utilities/psammead-storybook-helpers/src/input-provider.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx b/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx index fec25a55f2..76c56793a8 100644 --- a/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx +++ b/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx @@ -20,7 +20,7 @@ const inputProvider = (slots, componentFunction, services) => () => { // 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 + // When we switch to a language other than English, set the // text for the knob to the snippet from LANGUAGE_VARIANTS for that // language. return defaultText && isNews ? defaultText : service.text; From 69c31e231ca2106d1dba9eb23c6cfcd82a1e4e65 Mon Sep 17 00:00:00 2001 From: sadickisaac <48688870+sadickisaac@users.noreply.github.com> Date: Thu, 8 Aug 2019 15:21:23 +0300 Subject: [PATCH 4/4] Update packages/utilities/psammead-storybook-helpers/src/input-provider.jsx Co-Authored-By: Andrew Nowak <10963046+aacn500@users.noreply.github.com> --- .../utilities/psammead-storybook-helpers/src/input-provider.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx b/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx index 76c56793a8..184cdb867f 100644 --- a/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx +++ b/packages/utilities/psammead-storybook-helpers/src/input-provider.jsx @@ -21,7 +21,7 @@ const inputProvider = (slots, componentFunction, services) => () => { // 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 knob to the snippet from LANGUAGE_VARIANTS for that + // text for the slot to the snippet from LANGUAGE_VARIANTS for that // language. return defaultText && isNews ? defaultText : service.text; });