Merge pull request #27 from haricot/bootstrap4_1

Fixes carousel for Bootstrap 4.1
This commit was merged in pull request #27.
This commit is contained in:
Christopher S. Case
2018-06-14 19:11:12 -05:00
committed by GitHub
2 changed files with 20 additions and 24 deletions
+14 -14
View File
@@ -75,8 +75,8 @@ describe('carousel', function() {
});
it('should create clickable prev nav button', function() {
var navPrev = elm.find('a.left');
var navNext = elm.find('a.right');
var navPrev = elm.find('a.carousel-control-prev');
var navNext = elm.find('a.carousel-control-next');
expect(navPrev.length).toBe(1);
expect(navNext.length).toBe(1);
@@ -144,10 +144,10 @@ describe('carousel', function() {
var indicators = elm.find('ol.carousel-indicators > li');
expect(indicators.length).toBe(0);
var navNext = elm.find('a.right');
var navNext = elm.find('a.carousel-control-prev');
expect(navNext.length).toBe(0);
var navPrev = elm.find('a.left');
var navPrev = elm.find('a.carousel-control-next');
expect(navPrev.length).toBe(0);
});
@@ -160,7 +160,7 @@ describe('carousel', function() {
$scope.isPrevDisabled();
scope.$apply();
var navPrev = elm.find('a.left');
var navPrev = elm.find('a.carousel-control-prev');
expect(navPrev.hasClass('disabled')).toBe(true);
});
@@ -179,7 +179,7 @@ describe('carousel', function() {
$scope.isNextDisabled();
scope.$apply();
var navNext = elm.find('a.right');
var navNext = elm.find('a.carousel-control-prev');
expect(navNext.hasClass('disabled')).toBe(true);
});
@@ -187,15 +187,15 @@ describe('carousel', function() {
var indicators = elm.find('ol.carousel-indicators > li');
expect(indicators.length).not.toBe(0);
var navNext = elm.find('a.right');
var navNext = elm.find('a.carousel-control-next');
expect(navNext.length).not.toBe(0);
var navPrev = elm.find('a.left');
var navPrev = elm.find('a.carousel-control-prev');
expect(navPrev.length).not.toBe(0);
});
it('should go to next when clicking next button', function() {
var navNext = elm.find('a.right');
var navNext = elm.find('a.carousel-control-next');
testSlideActive(0);
navNext.click();
testSlideActive(1);
@@ -206,7 +206,7 @@ describe('carousel', function() {
});
it('should go to prev when clicking prev button', function() {
var navPrev = elm.find('a.left');
var navPrev = elm.find('a.carousel-control-prev');
testSlideActive(0);
navPrev.click();
testSlideActive(2);
@@ -326,7 +326,7 @@ describe('carousel', function() {
it('should not change if next is clicked while transitioning', function() {
var carouselScope = elm.children().scope();
var next = elm.find('a.right');
var next = elm.find('a.carousel-control-next');
testSlideActive(0);
carouselScope.$currentTransition = true;
@@ -387,7 +387,7 @@ describe('carousel', function() {
it('issue 4390 - should reset the currentTransition if there are no slides', function() {
var carouselScope = elm.children().scope();
var next = elm.find('a.right');
var next = elm.find('a.carousel-control-next');
scope.slides = [
{content:'new1', index: 1},
{content:'new2', index: 2},
@@ -448,14 +448,14 @@ describe('carousel', function() {
it('should select next after order change', function() {
testSlideActive(1);
var next = elm.find('a.right');
var next = elm.find('a.carousel-control-next');
next.click();
testSlideActive(2);
});
it('should select prev after order change', function() {
testSlideActive(1);
var prev = elm.find('a.left');
var prev = elm.find('a.carousel-control-prev');
prev.click();
testSlideActive(0);
});
+6 -10
View File
@@ -1,15 +1,11 @@
<div class="carousel-inner" ng-transclude></div>
<a role="button" href class="left carousel-control" ng-click="prev()" ng-class="{ disabled: isPrevDisabled() }" ng-show="slides.length > 1">
<span aria-hidden="true" class="fa-svg-icon">
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1427 301l-531 531 531 531q19 19 19 45t-19 45l-166 166q-19 19-45 19t-45-19l-742-742q-19-19-19-45t19-45l742-742q19-19 45-19t45 19l166 166q19 19 19 45t-19 45z"/></svg>
</span>
<span class="sr-only">previous</span>
<a role="button" href class="carousel-control-prev" ng-click="prev()" ng-class="{ disabled: isPrevDisabled() }" ng-show="slides.length > 1">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a role="button" href class="right carousel-control" ng-click="next()" ng-class="{ disabled: isNextDisabled() }" ng-show="slides.length > 1">
<span aria-hidden="true" class="fa-svg-icon">
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1363 877l-742 742q-19 19-45 19t-45-19l-166-166q-19-19-19-45t19-45l531-531-531-531q-19-19-19-45t19-45l166-166q19-19 45-19t45 19l742 742q19 19 19 45t-19 45z"/></svg>
</span>
<span class="sr-only">next</span>
<a role="button" href class="carousel-control-next" ng-click="next()" ng-class="{ disabled: isNextDisabled() }" ng-show="slides.length > 1">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<ol class="carousel-indicators" ng-show="slides.length > 1">
<li ng-repeat="slide in slides | orderBy:indexOfSlide track by $index" ng-class="{ active: isActive(slide) }" ng-click="select(slide)">