Skip to content

Commit

Permalink
fix(controls): Make badge part of SettingsToggle button (#1403)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Chan authored Jun 23, 2021
1 parent 6d04ebc commit ff7dbfb
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
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

0 comments on commit ff7dbfb

Please sign in to comment.