Skip to content

Commit

Permalink
feat(tabs: QUnit): Add tests for stilingMode option and classes
Browse files Browse the repository at this point in the history
  • Loading branch information
marker-dao committed Sep 5, 2023
1 parent 0a037c1 commit 0f5a4e2
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ const TABS_ICON_POSITION_CLASS = {
bottom: 'dx-tabs-icon-position-bottom',
start: 'dx-tabs-icon-position-start',
};
const TABS_STYLING_MODE_CLASS = {
primary: 'dx-tabs-styling-mode-primary',
secondary: 'dx-tabs-styling-mode-secondary',
};
const STYLING_MODE = {
primary: 'primary',
secondary: 'secondary',
};
const TABS_WRAPPER_CLASS = 'dx-tabs-wrapper';
const TABS_NAV_BUTTON_CLASS = 'dx-tabs-nav-button';
const TABS_NAV_BUTTONS_CLASS = 'dx-tabs-nav-buttons';
Expand Down Expand Up @@ -318,6 +326,19 @@ QUnit.module('General', () => {
assert.ok($element.hasClass(TABS_ICON_POSITION_CLASS[iconPosition]));
});
});

QUnit.test('the tabs element must have a correct styling mode class', function(assert) {
const $element = $('#tabs').dxTabs({ items: [1, 2, 3] });
const instance = $element.dxTabs('instance');

assert.strictEqual(instance.option('stylingMode'), STYLING_MODE.primary);
assert.strictEqual($element.hasClass(TABS_STYLING_MODE_CLASS.primary), true);

instance.option({ stylingMode: 'secondary' });

assert.strictEqual(instance.option('stylingMode'), STYLING_MODE.secondary);
assert.strictEqual($element.hasClass(TABS_STYLING_MODE_CLASS.secondary), true);
});
});

QUnit.module('Tab select action', () => {
Expand Down

0 comments on commit 0f5a4e2

Please sign in to comment.