Skip to content

Commit

Permalink
Add initial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Jul 28, 2022
1 parent 0888ec6 commit 0aa8bfe
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 @@ -132,6 +132,7 @@ describe('@lumino/widgets', () => {
tabsMovable: true,
allowDeselect: true,
addButtonEnabled: true,
scrollingEnabled: true,
insertBehavior: 'select-tab',
removeBehavior: 'select-previous-tab',
renderer
Expand All @@ -140,6 +141,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 @@ -588,6 +590,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 0aa8bfe

Please sign in to comment.