From 9432e4f1663ec9637f21c32d4cc1e4a9a65a8a8b Mon Sep 17 00:00:00 2001 From: Rish Date: Thu, 21 May 2020 12:02:41 +0530 Subject: [PATCH] Fixed Switch element tests no issue - Updated attaching onToggle to correct element on switch test --- ghost/portal/src/components/common/Switch.js | 2 +- ghost/portal/src/components/common/Switch.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ghost/portal/src/components/common/Switch.js b/ghost/portal/src/components/common/Switch.js index 3e4dcf2dd4..6ba64da236 100644 --- a/ghost/portal/src/components/common/Switch.js +++ b/ghost/portal/src/components/common/Switch.js @@ -13,7 +13,7 @@ function Switch({id, label, onToggle, checked = false}) { /> { onToggle(e); - }}> + }} data-testid="switch-input"> ); diff --git a/ghost/portal/src/components/common/Switch.test.js b/ghost/portal/src/components/common/Switch.test.js index 27717d75bd..cde120636a 100644 --- a/ghost/portal/src/components/common/Switch.test.js +++ b/ghost/portal/src/components/common/Switch.test.js @@ -13,7 +13,7 @@ const setup = (overrides = {}) => { ); - const checkboxEl = utils.getByLabelText(props.label); + const checkboxEl = utils.getByTestId('switch-input'); return { checkboxEl, mockOnToggle,