Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('returns the correct bucket for PI expressions', () => {
chai.assert.equal(getBucketForSelector('self::processing-instruction()'), 'type-7');
});
it('returns the correct bucket for named element expressions', () => {
it('returns the correct bucket for element expressions', () => {
chai.assert.equal(getBucketForSelector('self::element()'), 'type-1');
});
it('returns the correct bucket for expressions using the and operator', () => {
it('returns the correct bucket for element expressions', () => {
chai.assert.equal(getBucketForSelector('self::element()'), 'type-1');
});
it('returns the correct bucket for expressions using the and operator', () => {
it('returns the correct bucket for text expressions', () => {
chai.assert.equal(getBucketForSelector('self::text()'), 'type-3');
});
});
it('returns the correct bucket for expressions using the or operator, first not having a bucket', () => {
chai.assert.equal(getBucketForSelector('true() or self::element()'), null);
});
it('returns the correct bucket for expressions using the or operator, all having the same bucket', () => {
it('passes buckets for getChildNodes', () => {
jsonMlMapper.parse(['parentElement', ['childElement']], documentNode);
const parent = documentNode.firstChild;
const expectedBucket = getBucketForSelector('self::childElement');
const testDomFacade: IDomFacade = {
getChildNodes: (node, bucket: string | null) => {
chai.assert.equal(expectedBucket, bucket);
return [];
}
} as any;
evaluateXPathToNodes('child::childElement', parent, testDomFacade);
});
it('passes buckets for ancestor', () => {
jsonMlMapper.parse(['parentElement', ['childElement']], documentNode);
const childNode = documentNode.firstChild.firstChild;
const expectedBucket = getBucketForSelector('self::parentElement');
const testDomFacade: IDomFacade = {
getParentNode: (node: slimdom.Node, bucket: string | null) => {
chai.assert.equal(bucket, expectedBucket);
return null;
}
} as any;
evaluateXPathToNodes('ancestor::parentElement', childNode, testDomFacade);
});
});
it('returns the correct bucket for expressions using the or operator, all having the same bucket', () => {
chai.assert.equal(getBucketForSelector('self::element() or self::element()'), 'type-1');
});
it('returns the correct bucket for PI expressions', () => {
it('returns the correct bucket for text expressions', () => {
chai.assert.equal(getBucketForSelector('self::text()'), 'type-3');
});
});
it('returns the correct bucket for expressions using the and operator', () => {
chai.assert.equal(getBucketForSelector('self::element() and self::node()'), 'type-1');
});
it('returns the correct bucket for expressions using the and operator, first not having a bucket', () => {