Skip to content

Commit 9345a61

Browse files
committed
Add initial tests
1 parent 59bf5f1 commit 9345a61

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/widgets/tests/src/tabbar.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ describe('@lumino/widgets', () => {
144144
tabsMovable: true,
145145
allowDeselect: true,
146146
addButtonEnabled: true,
147+
scrollingEnabled: true,
147148
insertBehavior: 'select-tab',
148149
removeBehavior: 'select-previous-tab',
149150
renderer
@@ -152,6 +153,7 @@ describe('@lumino/widgets', () => {
152153
expect(newBar.tabsMovable).to.equal(true);
153154
expect(newBar.renderer).to.equal(renderer);
154155
expect(newBar.addButtonEnabled).to.equal(true);
156+
expect(newBar.scrollingEnabled).to.equal(true);
155157
});
156158

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

657+
describe('#scrollingEnabled', () => {
658+
it('should get whether the scroll buttons are enabled', () => {
659+
let bar = new TabBar<Widget>();
660+
expect(bar.scrollingEnabled).to.equal(false);
661+
});
662+
663+
it('should set whether the scroll buttons are enabled', () => {
664+
let bar = new TabBar<Widget>();
665+
bar.scrollingEnabled = true;
666+
expect(bar.scrollingEnabled).to.equal(true);
667+
});
668+
669+
it('should not show the scroll buttons if not set', () => {
670+
populateBar(bar);
671+
expect(
672+
bar.scrollBeforeButtonNode.classList.contains('lm-mod-hidden')
673+
).to.equal(true);
674+
expect(
675+
bar.scrollAfterButtonNode.classList.contains('lm-mod-hidden')
676+
).to.equal(true);
677+
678+
bar.scrollingEnabled = true;
679+
expect(
680+
bar.scrollBeforeButtonNode.classList.contains('lm-mod-hidden')
681+
).to.equal(false);
682+
expect(
683+
bar.scrollAfterButtonNode.classList.contains('lm-mod-hidden')
684+
).to.equal(true);
685+
});
686+
});
687+
655688
describe('#allowDeselect', () => {
656689
it('should determine whether a tab can be deselected by the user', () => {
657690
populateBar(bar);

0 commit comments

Comments
 (0)