|
1 | 1 | describe('tabs', function() {
|
2 |
| - beforeEach(module('ui.bootstrap.tabs', 'template/tabs/tabset.html', 'template/tabs/tab.html')); |
| 2 | + beforeEach(module('ui.bootstrap.tabs', 'template/tabs/tabset.html', 'template/tabs/tab.html', 'template/tabs/tabset-titles.html')); |
3 | 3 |
|
4 | 4 | var elm, scope;
|
5 | 5 | function titles() {
|
@@ -493,6 +493,56 @@ describe('tabs', function() {
|
493 | 493 | });
|
494 | 494 | });
|
495 | 495 |
|
| 496 | + describe('direction', function() { |
| 497 | + it('should not have `tab-left`, `tab-right` nor `tabs-below` classes if the direction is undefined', inject(function($compile, $rootScope) { |
| 498 | + scope = $rootScope.$new(); |
| 499 | + scope.direction = undefined; |
| 500 | + |
| 501 | + elm = $compile('<tabset direction="direction"></tabset>')(scope); |
| 502 | + scope.$apply(); |
| 503 | + expect(elm).not.toHaveClass('tabs-left'); |
| 504 | + expect(elm).not.toHaveClass('tabs-right'); |
| 505 | + expect(elm).not.toHaveClass('tabs-below'); |
| 506 | + expect(elm.find('.nav + .tab-content').length).toBe(1); |
| 507 | + })); |
| 508 | + |
| 509 | + it('should only have the `tab-left` direction class if the direction is "left"', inject(function($compile, $rootScope) { |
| 510 | + scope = $rootScope.$new(); |
| 511 | + scope.direction = 'left'; |
| 512 | + |
| 513 | + elm = $compile('<tabset direction="direction"></tabset>')(scope); |
| 514 | + scope.$apply(); |
| 515 | + expect(elm).toHaveClass('tabs-left'); |
| 516 | + expect(elm).not.toHaveClass('tabs-right'); |
| 517 | + expect(elm).not.toHaveClass('tabs-below'); |
| 518 | + expect(elm.find('.nav + .tab-content').length).toBe(1); |
| 519 | + })); |
| 520 | + |
| 521 | + it('should only have the `tab-right direction class if the direction is "right"', inject(function($compile, $rootScope) { |
| 522 | + scope = $rootScope.$new(); |
| 523 | + scope.direction = 'right'; |
| 524 | + |
| 525 | + elm = $compile('<tabset direction="direction"></tabset>')(scope); |
| 526 | + scope.$apply(); |
| 527 | + expect(elm).not.toHaveClass('tabs-left'); |
| 528 | + expect(elm).toHaveClass('tabs-right'); |
| 529 | + expect(elm).not.toHaveClass('tabs-below'); |
| 530 | + expect(elm.find('.nav + .tab-content').length).toBe(1); |
| 531 | + })); |
| 532 | + |
| 533 | + it('should only have the `tab-below direction class if the direction is "below"', inject(function($compile, $rootScope) { |
| 534 | + scope = $rootScope.$new(); |
| 535 | + scope.direction = 'below'; |
| 536 | + |
| 537 | + elm = $compile('<tabset direction="direction"></tabset>')(scope); |
| 538 | + scope.$apply(); |
| 539 | + expect(elm).not.toHaveClass('tabs-left'); |
| 540 | + expect(elm).not.toHaveClass('tabs-right'); |
| 541 | + expect(elm).toHaveClass('tabs-below'); |
| 542 | + expect(elm.find('.tab-content + .nav').length).toBe(1); |
| 543 | + })); |
| 544 | + }); |
| 545 | + |
496 | 546 | //https://github.com/angular-ui/bootstrap/issues/524
|
497 | 547 | describe('child compilation', function() {
|
498 | 548 |
|
|
0 commit comments