mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-29 15:15:23 -07:00
test: fix test cases after rebase
This commit is contained in:
@@ -4,7 +4,6 @@ import { FilterMap } from '../template/filter/filter-map'
|
|||||||
import { Filter } from './filter/filter'
|
import { Filter } from './filter/filter'
|
||||||
import { Context } from '../context/context'
|
import { Context } from '../context/context'
|
||||||
import { ValueToken } from '../tokens/value-token'
|
import { ValueToken } from '../tokens/value-token'
|
||||||
import { assert } from '../util/assert'
|
|
||||||
import { Liquid } from '../liquid'
|
import { Liquid } from '../liquid'
|
||||||
|
|
||||||
export class Value {
|
export class Value {
|
||||||
@@ -20,7 +19,6 @@ export class Value {
|
|||||||
this.filters = tokenizer.readFilters().map(({ name, args }) => new Filter(name, this.filterMap.get(name), args, liquid))
|
this.filters = tokenizer.readFilters().map(({ name, args }) => new Filter(name, this.filterMap.get(name), args, liquid))
|
||||||
}
|
}
|
||||||
public * value (ctx: Context) {
|
public * value (ctx: Context) {
|
||||||
assert(ctx, () => 'unable to evaluate: context not defined')
|
|
||||||
const lenient = ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default'
|
const lenient = ctx.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === 'default'
|
||||||
|
|
||||||
let val = yield evalToken(this.initial, ctx, lenient)
|
let val = yield evalToken(this.initial, ctx, lenient)
|
||||||
|
|||||||
@@ -2,15 +2,15 @@ import * as chai from 'chai'
|
|||||||
import * as sinonChai from 'sinon-chai'
|
import * as sinonChai from 'sinon-chai'
|
||||||
import { PropertyAccessToken } from '../../../src/tokens/property-access-token'
|
import { PropertyAccessToken } from '../../../src/tokens/property-access-token'
|
||||||
import { QuotedToken } from '../../../src/tokens/quoted-token'
|
import { QuotedToken } from '../../../src/tokens/quoted-token'
|
||||||
import { WordToken } from '../../../src/tokens/word-token'
|
import { IdentifierToken } from '../../../src/tokens/identifier-token'
|
||||||
|
|
||||||
chai.use(sinonChai)
|
chai.use(sinonChai)
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('PropertyAccessToken', function () {
|
describe('PropertyAccessToken', function () {
|
||||||
describe('getVariableAsText', function () {
|
describe('getVariableAsText', function () {
|
||||||
it('should return correct value for WordToken', function () {
|
it('should return correct value for IdentifierToken', function () {
|
||||||
const token = new PropertyAccessToken(new WordToken('foo', 0, 3), [], 3)
|
const token = new PropertyAccessToken(new IdentifierToken('foo', 0, 3), [], 3)
|
||||||
expect(token.getVariableAsText()).to.equal('foo')
|
expect(token.getVariableAsText()).to.equal('foo')
|
||||||
})
|
})
|
||||||
it('should return correct value for QuotedToken', function () {
|
it('should return correct value for QuotedToken', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user