Permalink
Browse files

Closes #86 Exposing `_tail` as `state.tails`

  • Loading branch information...
1 parent d5ef18c commit c6cf1f505c73d9bebc0291c2d58b7cdafd122ac8 @bemson committed Feb 23, 2014
Showing with 31 additions and 0 deletions.
  1. +1 −0 src/salt.js
  2. +30 −0 test/api.tag.tail.js
View
@@ -1658,6 +1658,7 @@
state.groups = currentNode.cGrps.concat();
state.delays = !!currentNode.delay;
state.fwds = !!~currentNode.nxt;
+ state.tails = !!~currentNode.tail;
// set pkg info
pkg.groups = currentNode.groups;
View
@@ -38,6 +38,36 @@ describe( '_tail tag', function () {
spy.should.not.have.been.called;
});
+ it( 'should be reflected in `.state.tails`', function () {
+ var doesTail = sinon.spy(function () {
+ this.state.tails.should.be.ok;
+ });
+
+ salt = new Salt({
+ has: {
+ _tail: 'tgt',
+ _in: doesTail,
+ _on: doesTail,
+ _out: doesTail,
+ _over: doesTail,
+ tgt: {
+ _tail: 0,
+ _on: doesTail,
+ _out: doesTail
+ }
+ },
+ nohas: {
+ _tail: 'badquery',
+ _on: function () {
+ this.state.tails.should.not.be.ok;
+ }
+ }
+ });
+ salt.go('//has');
+ salt.go('//nohas');
+ doesTail.callCount.should.equal(6);
+ });
+
it( 'should only apply to the destination state', function () {
var spy = sinon.spy();
salt = new Salt({

0 comments on commit c6cf1f5

Please sign in to comment.