fix: default length for truncate and truncatewords

This commit is contained in:
harttle
2019-02-23 03:11:07 +08:00
parent 5b6100d12b
commit 56c7992b76
11 changed files with 91 additions and 34 deletions
+13
View File
@@ -10,6 +10,7 @@ describe('scope', function () {
ctx = {
foo: 'zoo',
one: 1,
zoo: { size: 4 },
bar: {
zoo: 'coo',
'Mr.Smith': 'John',
@@ -133,6 +134,18 @@ describe('scope', function () {
it('should return undefined when not exist', function () {
expect(scope.get('foo.foo.foo')).to.be.undefined
})
it('should return string length as size', function () {
expect(scope.get('foo.size')).to.equal(3)
})
it('should return array length as size', function () {
expect(scope.get('bar.arr.size')).to.equal(2)
})
it('should return size property if exists', function () {
expect(scope.get('zoo.size')).to.equal(4)
})
it('should return undefined if do not have size and length', function () {
expect(scope.get('one.size')).to.equal(undefined)
})
})
describe('#set', function () {