Skip to content

Commit

Permalink
Updated visibility label copy for clarity (#1370)
Browse files Browse the repository at this point in the history
* Updated visibility label copy for clarity

REF PLG-179

* Updated tests

REF PLG-179
  • Loading branch information
sanne-san committed Aug 21, 2024
1 parent 2823b60 commit 37e0152
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions packages/koenig-lexical/src/hooks/useVisibilityToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export const useVisibilityToggle = (editor, nodeKey, cardConfig) => {
if (!showOnWeb && !showOnEmail) {
message = 'Hidden from both email and web';
} else if (showOnWeb && !showOnEmail) {
message = 'Shown on web only';
message = 'Only shown on web';
} else if (showOnWeb && showOnEmail && segmentLabel) {
message = `Shown on web and email to ${segmentLabel}`;
message = `Shown on web, and to ${segmentLabel} only in email`;
} else if (!showOnWeb && showOnEmail && !segmentLabel) {
message = 'Shown in email only';
message = 'Only shown in email';
} else if (!showOnWeb && showOnEmail && segmentLabel) {
message = `Shown in email to ${segmentLabel}`;
message = `Only shown to ${segmentLabel} in email`;
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/koenig-lexical/test/e2e/content-visibility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test.describe('Content Visibility', async () => {

await card.getByTestId('visibility-show-on-web-Toggle').click();

await expect(card.getByTestId('visibility-message')).toContainText('Shown in email only');
await expect(card.getByTestId('visibility-message')).toContainText('Only shown in email');
});

test('can toggle visibility settings - show on email is off', async function () {
Expand All @@ -91,7 +91,7 @@ test.describe('Content Visibility', async () => {

await card.getByTestId('visibility-show-on-email-Toggle').click();

await expect(card.getByTestId('visibility-message')).toContainText('Shown on web only');
await expect(card.getByTestId('visibility-message')).toContainText('Only shown on web');
});

test('can toggle visibility settings - show on email and web and all subscribers', async function () {
Expand All @@ -111,7 +111,7 @@ test.describe('Content Visibility', async () => {

await card.locator('[data-test-value="status:free"]').click();

await expect(card.getByTestId('visibility-message')).toContainText('Shown on web and email to free subscribers');
await expect(card.getByTestId('visibility-message')).toContainText('Shown on web, and to free subscribers only in email');
});

test('can toggle visibility settings segments - paid subscribers', async function () {
Expand All @@ -122,7 +122,7 @@ test.describe('Content Visibility', async () => {
await card.getByTestId('visibility-dropdown-segment').click();
await card.locator('[data-test-value="status:-free"]').click();

await expect(card.getByTestId('visibility-message')).toContainText('Shown on web and email to paid subscribers');
await expect(card.getByTestId('visibility-message')).toContainText('Shown on web, and to paid subscribers only in email');
});

test('can toggle visibility settings segments - all subscribers', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('useVisibilityToggle', () => {

expect(result.current[4]).toBe(false); // emailVisibility
expect(node.visibility.showOnEmail).toBe(false);
expect(result.current[7]).toBe('Shown on web only'); // message
expect(result.current[7]).toBe('Only shown on web'); // message
});

it('should toggleWeb and be able to update the node', () => {
Expand All @@ -91,7 +91,7 @@ describe('useVisibilityToggle', () => {

expect(result.current[5]).toBe(false); // webVisibility
expect(node.visibility.showOnWeb).toBe(false);
expect(result.current[7]).toBe('Shown in email only'); // message
expect(result.current[7]).toBe('Only shown in email'); // message
});

it('should toggleSegment and be able to update the node', () => {
Expand All @@ -105,7 +105,7 @@ describe('useVisibilityToggle', () => {

expect(result.current[3]).toBe('status:free'); // segment
expect(node.visibility.segment).toBe('status:free');
expect(result.current[7]).toBe('Shown on web and email to free subscribers'); // message
expect(result.current[7]).toBe('Shown on web, and to free subscribers only in email'); // message
});

it('should update the message correctly when both toggles are off', () => {
Expand Down

0 comments on commit 37e0152

Please sign in to comment.