Skip to content

Commit

Permalink
Add initial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Aug 3, 2022
1 parent 59bf5f1 commit 9345a61
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/widgets/tests/src/tabbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ describe('@lumino/widgets', () => {
tabsMovable: true,
allowDeselect: true,
addButtonEnabled: true,
scrollingEnabled: true,
insertBehavior: 'select-tab',
removeBehavior: 'select-previous-tab',
renderer
Expand All @@ -152,6 +153,7 @@ describe('@lumino/widgets', () => {
expect(newBar.tabsMovable).to.equal(true);
expect(newBar.renderer).to.equal(renderer);
expect(newBar.addButtonEnabled).to.equal(true);
expect(newBar.scrollingEnabled).to.equal(true);
});

it('should add the `lm-TabBar` class', () => {
Expand Down Expand Up @@ -652,6 +654,37 @@ describe('@lumino/widgets', () => {
});
});

describe('#scrollingEnabled', () => {
it('should get whether the scroll buttons are enabled', () => {
let bar = new TabBar<Widget>();
expect(bar.scrollingEnabled).to.equal(false);
});

it('should set whether the scroll buttons are enabled', () => {
let bar = new TabBar<Widget>();
bar.scrollingEnabled = true;
expect(bar.scrollingEnabled).to.equal(true);
});

it('should not show the scroll buttons if not set', () => {
populateBar(bar);
expect(
bar.scrollBeforeButtonNode.classList.contains('lm-mod-hidden')
).to.equal(true);
expect(
bar.scrollAfterButtonNode.classList.contains('lm-mod-hidden')
).to.equal(true);

bar.scrollingEnabled = true;
expect(
bar.scrollBeforeButtonNode.classList.contains('lm-mod-hidden')
).to.equal(false);
expect(
bar.scrollAfterButtonNode.classList.contains('lm-mod-hidden')
).to.equal(true);
});
});

describe('#allowDeselect', () => {
it('should determine whether a tab can be deselected by the user', () => {
populateBar(bar);
Expand Down

0 comments on commit 9345a61

Please sign in to comment.