Skip to content
This repository has been archived by the owner on May 2, 2019. It is now read-only.

Commit

Permalink
Fixing #39, silent flag does not work with an array on push()
Browse files Browse the repository at this point in the history
  • Loading branch information
hay committed Apr 17, 2013
1 parent 6341eae commit cd999ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.html
Expand Up @@ -931,7 +931,7 @@ <h2>module.map( function, [context] )</h2>
<h1>push</h1>

<h2>module.push( value, [silent] );</h2>
<h2>module.push( array );</h2>
<h2>module.push( array, [silent] );</h2>

<p>Sets a value, automatically generates an unique uuid as a key.</p>

Expand Down Expand Up @@ -1308,6 +1308,7 @@ <h3 id="m-history">History</h3>
<li>0.7.2</li>
<ul>
<li><small>Feature</small> <a href="#m-remove"><code>remove</code></a> without any arguments now removes all attributes in a module.</li>
<li><small>Bugfix</small> The <code>silent</code> flag did not work with <a href="m-push"><code>push</code></a> (issue <a href="https://github.com/hay/stapes/issues/39">#39</a>). Thanks for reporting <a href="https://github.com/Gamadril">Gamadril</a>!</li>
</ul>
<li>0.7.1 - February 27th 2013</li>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion stapes.js
Expand Up @@ -489,7 +489,7 @@
push : function(input, silent) {
if (_.typeOf(input) === "array") {
for (var i = 0, l = input.length; i < l; i++) {
_.setAttribute.call(this, _.makeUuid(), input[i]);
_.setAttribute.call(this, _.makeUuid(), input[i], silent || false);
}
} else {
_.setAttribute.call(this, _.makeUuid(), input, silent || false);
Expand Down
14 changes: 14 additions & 0 deletions test/test.js
Expand Up @@ -413,6 +413,20 @@ test("Extending Stapes (plugins)", function() {
module.foo();
});

test("push", function() {
expect(0);

var module = new ( Stapes.subclass() );

// Issue #39, silent flag ignored in an array
module.on('change', function() {
ok(false, "Silent flag should be ignored with array");
});

module.push(true, true);
module.push([1,2,3], true);
});

test("remove", function() {
expect(5);

Expand Down

0 comments on commit cd999ae

Please sign in to comment.