assign tag, abs filter

This commit is contained in:
harttle
2016-06-15 03:21:35 +08:00
parent 51b2406187
commit 611882ae10
10 changed files with 176 additions and 36 deletions
+7 -1
View File
@@ -6,7 +6,7 @@ var context = require('../context.js');
describe('context', function() {
var ctx;
before(function(){
beforeEach(function(){
ctx = context.factory({
foo: 'bar',
bar: ['a', {b: [1, 2]}]
@@ -23,6 +23,11 @@ describe('context', function() {
ctx.get('foo').should.equal('bar');
});
it('should set property', function() {
ctx.set('foo', 'FOO');
ctx.get('foo').should.equal('FOO');
});
it('should get desendent property', function() {
ctx.get('bar[0]').should.equal('a');
ctx.get('bar[1].b').should.deep.equal([1, 2]);
@@ -37,6 +42,7 @@ describe('context', function() {
});
it('should pop context', function() {
ctx.push({foo: 'foo', foo1: 'foo1'});
ctx.pop();
expect(ctx.get('foo')).to.equal('bar');
expect(ctx.get('foo1')).to.equal('');