@fullstackio/cq
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -363,3 +363,3 @@ 'use strict'; | ||
var start = rangeStart.start; | ||
var rangeEnd = resolveIndividualQuery(ast, root, code, query.end, engine, Object.assign({}, opts, { after: rangeStart.end })); | ||
var rangeEnd = resolveIndividualQuery(ast, root, code, query.end, engine, Object.assign({}, opts, { after: rangeStart.start })); | ||
var end = rangeEnd.end; | ||
@@ -366,0 +366,0 @@ var codeSlice = code.substring(start, end); |
{ | ||
"name": "@fullstackio/cq", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "query code with selectors", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -286,3 +286,3 @@ /** | ||
let rangeEnd = resolveIndividualQuery(ast, root, code, query.end, engine, | ||
Object.assign({}, opts, {after: rangeStart.end})); | ||
Object.assign({}, opts, {after: rangeStart.start})); | ||
let end = rangeEnd.end; | ||
@@ -289,0 +289,0 @@ let codeSlice = code.substring(start, end); |
@@ -290,3 +290,2 @@ import 'babel-polyfill'; | ||
let { code } = cq(es6Class, 'context(.distance, -1, -1)'); | ||
console.log(code); | ||
const wanted = lines(es6Class, 3, 5); | ||
@@ -308,2 +307,14 @@ assert.equal(code, wanted); | ||
it('should get a constructor as a child of the class', () => { | ||
let { code } = cq(es6Class, '.Polygon .constructor'); | ||
const wanted = lines(es6Class, 8, 11); | ||
assert.equal(code, wanted); | ||
}); | ||
it('should get a constructor as a child of the class in a range', () => { | ||
let { code } = cq(es6Class, '.Polygon-(.Polygon .constructor)'); | ||
const wanted = lines(es6Class, 1, 11); | ||
assert.equal(code, wanted); | ||
}); | ||
}); | ||
@@ -310,0 +321,0 @@ |
@@ -416,2 +416,8 @@ import 'babel-polyfill' | ||
it('should get a constructor as part of a child range', () => { | ||
let { code } = cq(src, ".Barn-(.Barn .constructor)", {engine: 'typescript'}); | ||
const wanted = lines(src, 4, 9); | ||
assert.equal(code, wanted); | ||
}) | ||
}); | ||
@@ -418,0 +424,0 @@ |
689033
4604