Skip to content

Commit 0aa8bfe

Browse files
committed
Add initial tests
1 parent 0888ec6 commit 0aa8bfe

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
@@ -132,6 +132,7 @@ describe('@lumino/widgets', () => {
132132
tabsMovable: true,
133133
allowDeselect: true,
134134
addButtonEnabled: true,
135+
scrollingEnabled: true,
135136
insertBehavior: 'select-tab',
136137
removeBehavior: 'select-previous-tab',
137138
renderer
@@ -140,6 +141,7 @@ describe('@lumino/widgets', () => {
140141
expect(newBar.tabsMovable).to.equal(true);
141142
expect(newBar.renderer).to.equal(renderer);
142143
expect(newBar.addButtonEnabled).to.equal(true);
144+
expect(newBar.scrollingEnabled).to.equal(true);
143145
});
144146

145147
it('should add the `lm-TabBar` class', () => {
@@ -588,6 +590,37 @@ describe('@lumino/widgets', () => {
588590
});
589591
});
590592

593+
describe('#scrollingEnabled', () => {
594+
it('should get whether the scroll buttons are enabled', () => {
595+
let bar = new TabBar<Widget>();
596+
expect(bar.scrollingEnabled).to.equal(false);
597+
});
598+
599+
it('should set whether the scroll buttons are enabled', () => {
600+
let bar = new TabBar<Widget>();
601+
bar.scrollingEnabled = true;
602+
expect(bar.scrollingEnabled).to.equal(true);
603+
});
604+
605+
it('should not show the scroll buttons if not set', () => {
606+
populateBar(bar);
607+
expect(
608+
bar.scrollBeforeButtonNode.classList.contains('lm-mod-hidden')
609+
).to.equal(true);
610+
expect(
611+
bar.scrollAfterButtonNode.classList.contains('lm-mod-hidden')
612+
).to.equal(true);
613+
614+
bar.scrollingEnabled = true;
615+
expect(
616+
bar.scrollBeforeButtonNode.classList.contains('lm-mod-hidden')
617+
).to.equal(false);
618+
expect(
619+
bar.scrollAfterButtonNode.classList.contains('lm-mod-hidden')
620+
).to.equal(true);
621+
});
622+
});
623+
591624
describe('#allowDeselect', () => {
592625
it('should determine whether a tab can be deselected by the user', () => {
593626
populateBar(bar);

0 commit comments

Comments
 (0)