aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/src/collapse.js3
-rw-r--r--js/tests/unit/collapse.spec.js2
2 files changed, 3 insertions, 2 deletions
diff --git a/js/src/collapse.js b/js/src/collapse.js
index 8831510df..22bd31f9b 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -50,6 +50,7 @@ const CLASS_NAME_SHOW = 'show'
const CLASS_NAME_COLLAPSE = 'collapse'
const CLASS_NAME_COLLAPSING = 'collapsing'
const CLASS_NAME_COLLAPSED = 'collapsed'
+const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'
const WIDTH = 'width'
const HEIGHT = 'height'
@@ -266,7 +267,7 @@ class Collapse extends BaseComponent {
}
_getDimension() {
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT
}
_getParent() {
diff --git a/js/tests/unit/collapse.spec.js b/js/tests/unit/collapse.spec.js
index 11d8d52bf..9bce3f0bb 100644
--- a/js/tests/unit/collapse.spec.js
+++ b/js/tests/unit/collapse.spec.js
@@ -225,7 +225,7 @@ describe('Collapse', () => {
})
it('should show a collapsed element on width', done => {
- fixtureEl.innerHTML = '<div class="collapse width" style="width: 0px;"></div>'
+ fixtureEl.innerHTML = '<div class="collapse collapse-horizontal" style="width: 0px;"></div>'
const collapseEl = fixtureEl.querySelector('div')
const collapse = new Collapse(collapseEl, {