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

Commit

Permalink
Merge pull request #66 from mobify/release-6.0.1
Browse files Browse the repository at this point in the history
Release 6.0.1
  • Loading branch information
Marlow Payne committed Oct 23, 2016
2 parents e3819f5 + 114956d commit b531620
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,3 +1,6 @@
6.0.1
- Fix [#62](https://github.com/mobify/bellows/issues/62): Use published Plugin dependency
- Fix [#63](https://github.com/mobify/bellows/issues/63): Short circuit open if other items are opening
6.0.0 6.0.0
- Publish to NPM - Publish to NPM
- Remove Zepto support in favor of jQuery - Remove Zepto support in favor of jQuery
Expand Down
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -16,6 +16,7 @@ You can find a simple demo on [the Documentation page](http://mobify.github.io/b


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


### Zepto Support ### Zepto Support


Expand All @@ -39,7 +40,7 @@ To use with require.js, after installing through NPM you merely have to referenc
{ {
'paths': { 'paths': {
'$': 'node_modules/bellows-ui/node_modules/jquery/dist/jquery.min', '$': 'node_modules/bellows-ui/node_modules/jquery/dist/jquery.min',
'plugin': 'node_modules/bellows-ui/node_modules/plugin/dist/plugin.min', 'plugin': 'node_modules/bellows-ui/node_modules/mobify-plugin/dist/plugin.min',
'velocity': 'node_modules/bellows-ui/node_modules/velocity-animate/velocity' 'velocity': 'node_modules/bellows-ui/node_modules/velocity-animate/velocity'
'bellows': 'node_modules/bellows-ui/dist/bellows.min', 'bellows': 'node_modules/bellows-ui/dist/bellows.min',
} }
Expand Down Expand Up @@ -103,7 +104,7 @@ At a bare minimum, your markup structure should follow the above structure. You
<!-- Include dependencies --> <!-- Include dependencies -->
<script src="jqueryin.js"></script> <script src="jqueryin.js"></script>
<script src="node_modules/velocity-animate/velocity.min.js"></script> <script src="node_modules/velocity-animate/velocity.min.js"></script>
<script src="node_modules/plugin/dist/plugin.min.js"></script> <script src="node_modules/mobify-plugin/dist/plugin.min.js"></script>


<!-- Include bellows.js --> <!-- Include bellows.js -->
<script src="bellows.min.js"></script> <script src="bellows.min.js"></script>
Expand Down
12 changes: 12 additions & 0 deletions dist/bellows.js
Expand Up @@ -137,6 +137,13 @@
.attr('aria-hidden', true); .attr('aria-hidden', true);
}, },


/*
Checks if other bellows items are currently opening
*/
_othersAreOpening: function() {
return this.$bellows.find('.' + cssClasses.OPENING).length > 0;
},

toggle: function($item) { toggle: function($item) {
$item = this._item($item); $item = this._item($item);


Expand All @@ -155,6 +162,11 @@


if (this.options.singleItemOpen) { if (this.options.singleItemOpen) {
this.closeAll(); this.closeAll();

// Fix #63
if (this._othersAreOpening()) {
return;
}
} }


this._trigger('open', {item: $item}); this._trigger('open', {item: $item});
Expand Down
2 changes: 1 addition & 1 deletion dist/bellows.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/assets/js/config.js
Expand Up @@ -5,7 +5,7 @@ require.config({
'text': 'node_modules/text/text', 'text': 'node_modules/text/text',
'$': 'node_modules/jquery/dist/jquery', '$': 'node_modules/jquery/dist/jquery',
'velocity': 'node_modules/velocity-animate/velocity', 'velocity': 'node_modules/velocity-animate/velocity',
'plugin': 'node_modules/plugin/dist/plugin.min', 'plugin': 'node_modules/mobify-plugin/dist/plugin.min',
'bellows': 'dist/bellows', 'bellows': 'dist/bellows',
'setup-bellows': 'examples/assets/js/setup-bellows' 'setup-bellows': 'examples/assets/js/setup-bellows'
}, },
Expand Down
2 changes: 1 addition & 1 deletion examples/norequire.html
Expand Up @@ -56,7 +56,7 @@ <h3>Header</h3>
<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> <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>


<script src="../node_modules/jquery/dist/jquery.js" ></script> <script src="../node_modules/jquery/dist/jquery.js" ></script>
<script src="../node_modules/plugin/dist/plugin.js" ></script> <script src="../node_modules/mobify-plugin/dist/plugin.js" ></script>
<script src="../node_modules/velocity-animate/velocity.js"></script> <script src="../node_modules/velocity-animate/velocity.js"></script>
<script src="../src/js/bellows.js" ></script> <script src="../src/js/bellows.js" ></script>
<script src="assets/js/setup-bellows.js"></script> <script src="assets/js/setup-bellows.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -4,7 +4,7 @@
"type": "git", "type": "git",
"url": "git+https://github.com/mobify/bellows.git" "url": "git+https://github.com/mobify/bellows.git"
}, },
"version": "6.0.0", "version": "6.0.1",
"description": "A mobile-first JavaScript-driven accordion UI plugin", "description": "A mobile-first JavaScript-driven accordion UI plugin",
"devDependencies": { "devDependencies": {
"chai": "1.9.2", "chai": "1.9.2",
Expand All @@ -26,7 +26,6 @@
"mobify-code-style": "^2.4.2", "mobify-code-style": "^2.4.2",
"mocha": "1.14.0", "mocha": "1.14.0",
"node-sass-import-once": "1.2.0", "node-sass-import-once": "1.2.0",
"plugin": "git+https://github.com/mobify/plugin.git#3.1.0",
"requirejs": "2.2.0", "requirejs": "2.2.0",
"requirejs-glob": "git+https://github.com/mobify/requirejs-glob.git", "requirejs-glob": "git+https://github.com/mobify/requirejs-glob.git",
"text": "requirejs/text" "text": "requirejs/text"
Expand Down Expand Up @@ -55,6 +54,7 @@
"author": "Mobify", "author": "Mobify",
"dependencies": { "dependencies": {
"jquery": "2.2.2", "jquery": "2.2.2",
"velocity-animate": "1.2.3" "velocity-animate": "1.2.3",
"mobify-plugin": "4.0.0"
} }
} }
12 changes: 12 additions & 0 deletions src/js/bellows.js
Expand Up @@ -137,6 +137,13 @@
.attr('aria-hidden', true); .attr('aria-hidden', true);
}, },


/*
Checks if other bellows items are currently opening
*/
_othersAreOpening: function() {
return this.$bellows.find('.' + cssClasses.OPENING).length > 0;
},

toggle: function($item) { toggle: function($item) {
$item = this._item($item); $item = this._item($item);


Expand All @@ -155,6 +162,11 @@


if (this.options.singleItemOpen) { if (this.options.singleItemOpen) {
this.closeAll(); this.closeAll();

// Fix #63
if (this._othersAreOpening()) {
return;
}
} }


this._trigger('open', {item: $item}); this._trigger('open', {item: $item});
Expand Down
2 changes: 1 addition & 1 deletion tests/runner/sandbox-config.js
Expand Up @@ -7,7 +7,7 @@ require.config({
'velocity': 'node_modules/velocity-animate/velocity', 'velocity': 'node_modules/velocity-animate/velocity',
'chai': 'node_modules/chai/chai', 'chai': 'node_modules/chai/chai',
'mocha': 'node_modules/mocha/mocha', 'mocha': 'node_modules/mocha/mocha',
'plugin': 'node_modules/plugin/dist/plugin', 'plugin': 'node_modules/mobify-plugin/dist/plugin',
'bellows': 'dist/bellows' 'bellows': 'dist/bellows'
}, },
'shim': { 'shim': {
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/plugin.js
Expand Up @@ -282,5 +282,20 @@ define([
expect($openDisabledItem.hasClass('bellows--is-open')).to.be.true; expect($openDisabledItem.hasClass('bellows--is-open')).to.be.true;
}); });
}); });

describe('a Bellows instance with singleItemOpen set', function() {
it('only allows a single item open when opening another item', function() {
$element.bellows({
singleItemOpen: true,
opened: function() {
$element.bellows('open', 1);
$element.find('.bellows__item.bellows--is-open').to.have.length(1);
done();
}
});

$element.bellows('open', 0);
});
});
}); });
}); });

0 comments on commit b531620

Please sign in to comment.