How to use the fontoxpath.getBucketForSelector function in fontoxpath

To help you get started, we’ve selected a few fontoxpath examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.ts View on Github external
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', () => {
github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.js View on Github external
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', () => {
github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.ts View on Github external
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', () => {
github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.ts View on Github external
it('returns the correct bucket for text expressions', () => {
		chai.assert.equal(getBucketForSelector('self::text()'), 'type-3');
	});
});
github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.ts View on Github external
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', () => {
github FontoXML / fontoxpath / test / specs / parsing / axes / ChildAxis.tests.ts View on Github external
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);
	});
github FontoXML / fontoxpath / test / specs / parsing / axes / AncestorAxis.tests.ts View on Github external
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);
	});
});
github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.ts View on Github external
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', () => {
github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.js View on Github external
it('returns the correct bucket for text expressions', () => {
		chai.assert.equal(getBucketForSelector('self::text()'), 'type-3');
	});
});
github FontoXML / fontoxpath / test / specs / parsing / getBucketForSelector.tests.ts View on Github external
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', () => {