Skip to content
This repository was archived by the owner on Aug 5, 2020. It is now read-only.

Commit b531620

Browse files
author
Marlow Payne
authored
Merge pull request #66 from mobify/release-6.0.1
Release 6.0.1
2 parents e3819f5 + 114956d commit b531620

File tree

10 files changed

+52
-9
lines changed

10 files changed

+52
-9
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
6.0.1
2+
- Fix [#62](https://github.com/mobify/bellows/issues/62): Use published Plugin dependency
3+
- Fix [#63](https://github.com/mobify/bellows/issues/63): Short circuit open if other items are opening
14
6.0.0
25
- Publish to NPM
36
- Remove Zepto support in favor of jQuery

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ You can find a simple demo on [the Documentation page](http://mobify.github.io/b
1616

1717
* [jQuery](http://jquery.com/)
1818
* [Velocity.js](http://julian.com/research/velocity/)
19+
* [Mobify's Plugin Factory](https://www.npmjs.com/package/mobify-plugin/)
1920

2021
### Zepto Support
2122

@@ -39,7 +40,7 @@ To use with require.js, after installing through NPM you merely have to referenc
3940
{
4041
'paths': {
4142
'$': 'node_modules/bellows-ui/node_modules/jquery/dist/jquery.min',
42-
'plugin': 'node_modules/bellows-ui/node_modules/plugin/dist/plugin.min',
43+
'plugin': 'node_modules/bellows-ui/node_modules/mobify-plugin/dist/plugin.min',
4344
'velocity': 'node_modules/bellows-ui/node_modules/velocity-animate/velocity'
4445
'bellows': 'node_modules/bellows-ui/dist/bellows.min',
4546
}
@@ -103,7 +104,7 @@ At a bare minimum, your markup structure should follow the above structure. You
103104
<!-- Include dependencies -->
104105
<script src="jqueryin.js"></script>
105106
<script src="node_modules/velocity-animate/velocity.min.js"></script>
106-
<script src="node_modules/plugin/dist/plugin.min.js"></script>
107+
<script src="node_modules/mobify-plugin/dist/plugin.min.js"></script>
107108

108109
<!-- Include bellows.js -->
109110
<script src="bellows.min.js"></script>

dist/bellows.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@
137137
.attr('aria-hidden', true);
138138
},
139139

140+
/*
141+
Checks if other bellows items are currently opening
142+
*/
143+
_othersAreOpening: function() {
144+
return this.$bellows.find('.' + cssClasses.OPENING).length > 0;
145+
},
146+
140147
toggle: function($item) {
141148
$item = this._item($item);
142149

@@ -155,6 +162,11 @@
155162

156163
if (this.options.singleItemOpen) {
157164
this.closeAll();
165+
166+
// Fix #63
167+
if (this._othersAreOpening()) {
168+
return;
169+
}
158170
}
159171

160172
this._trigger('open', {item: $item});

dist/bellows.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/assets/js/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require.config({
55
'text': 'node_modules/text/text',
66
'$': 'node_modules/jquery/dist/jquery',
77
'velocity': 'node_modules/velocity-animate/velocity',
8-
'plugin': 'node_modules/plugin/dist/plugin.min',
8+
'plugin': 'node_modules/mobify-plugin/dist/plugin.min',
99
'bellows': 'dist/bellows',
1010
'setup-bellows': 'examples/assets/js/setup-bellows'
1111
},

examples/norequire.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h3>Header</h3>
5656
<p>Lorem honeyed locusts sit amet, none so wise, sed do eiusmod never resting ut labore et dolore magna aliqua. Manhood death before disgrace warrior, feed it to the goats spare me your false courtesy commodo consequat. Mace aute irure dolor in reprehenderit poison is a woman's weapon lord of light tower dwarf. The last of the dragons royal, godswood garron sister betrothed officia deserunt mollit anim id est snow.</p>
5757

5858
<script src="../node_modules/jquery/dist/jquery.js" ></script>
59-
<script src="../node_modules/plugin/dist/plugin.js" ></script>
59+
<script src="../node_modules/mobify-plugin/dist/plugin.js" ></script>
6060
<script src="../node_modules/velocity-animate/velocity.js"></script>
6161
<script src="../src/js/bellows.js" ></script>
6262
<script src="assets/js/setup-bellows.js"></script>

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "git",
55
"url": "git+https://github.com/mobify/bellows.git"
66
},
7-
"version": "6.0.0",
7+
"version": "6.0.1",
88
"description": "A mobile-first JavaScript-driven accordion UI plugin",
99
"devDependencies": {
1010
"chai": "1.9.2",
@@ -26,7 +26,6 @@
2626
"mobify-code-style": "^2.4.2",
2727
"mocha": "1.14.0",
2828
"node-sass-import-once": "1.2.0",
29-
"plugin": "git+https://github.com/mobify/plugin.git#3.1.0",
3029
"requirejs": "2.2.0",
3130
"requirejs-glob": "git+https://github.com/mobify/requirejs-glob.git",
3231
"text": "requirejs/text"
@@ -55,6 +54,7 @@
5554
"author": "Mobify",
5655
"dependencies": {
5756
"jquery": "2.2.2",
58-
"velocity-animate": "1.2.3"
57+
"velocity-animate": "1.2.3",
58+
"mobify-plugin": "4.0.0"
5959
}
6060
}

src/js/bellows.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@
137137
.attr('aria-hidden', true);
138138
},
139139

140+
/*
141+
Checks if other bellows items are currently opening
142+
*/
143+
_othersAreOpening: function() {
144+
return this.$bellows.find('.' + cssClasses.OPENING).length > 0;
145+
},
146+
140147
toggle: function($item) {
141148
$item = this._item($item);
142149

@@ -155,6 +162,11 @@
155162

156163
if (this.options.singleItemOpen) {
157164
this.closeAll();
165+
166+
// Fix #63
167+
if (this._othersAreOpening()) {
168+
return;
169+
}
158170
}
159171

160172
this._trigger('open', {item: $item});

tests/runner/sandbox-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require.config({
77
'velocity': 'node_modules/velocity-animate/velocity',
88
'chai': 'node_modules/chai/chai',
99
'mocha': 'node_modules/mocha/mocha',
10-
'plugin': 'node_modules/plugin/dist/plugin',
10+
'plugin': 'node_modules/mobify-plugin/dist/plugin',
1111
'bellows': 'dist/bellows'
1212
},
1313
'shim': {

tests/unit/plugin.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,5 +282,20 @@ define([
282282
expect($openDisabledItem.hasClass('bellows--is-open')).to.be.true;
283283
});
284284
});
285+
286+
describe('a Bellows instance with singleItemOpen set', function() {
287+
it('only allows a single item open when opening another item', function() {
288+
$element.bellows({
289+
singleItemOpen: true,
290+
opened: function() {
291+
$element.bellows('open', 1);
292+
$element.find('.bellows__item.bellows--is-open').to.have.length(1);
293+
done();
294+
}
295+
});
296+
297+
$element.bellows('open', 0);
298+
});
299+
});
285300
});
286301
});

0 commit comments

Comments
 (0)