Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2022-03-10 01:38:17 +0300
committerXhmikosR <xhmikosr@gmail.com>2022-03-10 16:22:14 +0300
commit88da704eedc5149b70dcec7845453456a6e26761 (patch)
tree3ffdce0b721c7b1440611037843cfc3f700190a8
parent28f150d7204788114e2b36555f5e07eb8bdfdbab (diff)
Carousel: omit redundant checks as we are always transforming the right values
-rw-r--r--js/src/carousel.js8
-rw-r--r--js/tests/unit/carousel.spec.js4
2 files changed, 0 insertions, 12 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index 37ebde3fcc..70c5fd286a 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -389,10 +389,6 @@ class Carousel extends BaseComponent {
}
_directionToOrder(direction) {
- if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
- return direction
- }
-
if (isRTL()) {
return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT
}
@@ -401,10 +397,6 @@ class Carousel extends BaseComponent {
}
_orderToDirection(order) {
- if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
- return order
- }
-
if (isRTL()) {
return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT
}
diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js
index d6320debf0..536a60e271 100644
--- a/js/tests/unit/carousel.spec.js
+++ b/js/tests/unit/carousel.spec.js
@@ -1200,9 +1200,7 @@ describe('Carousel', () => {
const carousel = new Carousel(carouselEl, {})
expect(carousel._directionToOrder('left')).toEqual('next')
- expect(carousel._directionToOrder('prev')).toEqual('prev')
expect(carousel._directionToOrder('right')).toEqual('prev')
- expect(carousel._directionToOrder('next')).toEqual('next')
expect(carousel._orderToDirection('next')).toEqual('left')
expect(carousel._orderToDirection('prev')).toEqual('right')
@@ -1217,9 +1215,7 @@ describe('Carousel', () => {
expect(isRTL()).toBeTrue()
expect(carousel._directionToOrder('left')).toEqual('prev')
- expect(carousel._directionToOrder('prev')).toEqual('prev')
expect(carousel._directionToOrder('right')).toEqual('next')
- expect(carousel._directionToOrder('next')).toEqual('next')
expect(carousel._orderToDirection('next')).toEqual('right')
expect(carousel._orderToDirection('prev')).toEqual('left')