Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(controls): Make badge part of SettingsToggle button #1403

Merged
merged 1 commit into from
Jun 23, 2021
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
2 changes: 1 addition & 1 deletion src/lib/viewers/controls/settings/SettingsToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function SettingsToggle({ badge, isOpen, onClick }: Props, ref: React.Ref<Ref>):
type="button"
>
<IconGear24 className="bp-SettingsToggle-icon" />
{React.isValidElement(badge) && <div className="bp-SettingsToggle-badge">{badge}</div>}
</button>
{React.isValidElement(badge) && <div className="bp-SettingsToggle-badge">{badge}</div>}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,12 @@ describe('SettingsToggle', () => {

expect(wrapper.hasClass('bp-is-open')).toBe(isOpen);
});

test('should render badge if provided', () => {
const Badge = (): JSX.Element => <div className="badge">Badge</div>;
const wrapper = getWrapper({ badge: <Badge /> });

expect(wrapper.exists(Badge)).toBe(true);
});
});
});
4 changes: 2 additions & 2 deletions test/integration/media/DashViewer.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Dash Viewer', () => {
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
});

runBaseMediaSettingsTests();
Expand All @@ -42,7 +42,7 @@ describe('Dash Viewer', () => {
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
});

runBaseMediaSettingsTests();
Expand Down
4 changes: 2 additions & 2 deletions test/integration/media/MP3Viewer.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('MP3 Viewer', () => {
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
});

runBaseMediaSettingsTests();
Expand All @@ -31,7 +31,7 @@ describe('MP3 Viewer', () => {
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
});

runBaseMediaSettingsTests();
Expand Down
4 changes: 2 additions & 2 deletions test/integration/media/MP4Viewer.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('MP4 Viewer', () => {
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
});

runBaseMediaSettingsTests();
Expand All @@ -31,7 +31,7 @@ describe('MP4 Viewer', () => {
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
});

runBaseMediaSettingsTests();
Expand Down
2 changes: 1 addition & 1 deletion test/integration/media/Video360Viewer.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Video360 Viewer', () => {
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
});

runBaseMediaSettingsTests();
Expand Down
2 changes: 1 addition & 1 deletion test/support/mediaSettingsTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function runBaseMediaSettingsTests() {
cy.getByTestId('bp-media-settings-speed').contains('Normal');

// Close the menu
cy.getByTitle('Settings').click({ force: true });
cy.getByTitle('Settings').click();
cy.getByTestId('bp-settings-flyout').should('not.be.visible');
});

Expand Down