electron/spec-main/internal-spec.ts
Heilig Benedek 74372d65ae
feat: enhance native window.open to match the custom implementation's behavior (#19703)
Co-authored-by: Andy Locascio <andy@slack-corp.com>
2020-03-26 11:05:45 -07:00

22 lines
1 KiB
TypeScript

import { expect } from 'chai';
describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => {
const { parseFeaturesString } = require('../lib/common/parse-features-string');
const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
const features: Record<string, string | boolean> = {};
parseFeaturesString(string, (k: string, v: any) => { features[k] = v; });
expect(features).to.deep.equal(parsed);
};
checkParse('a=yes,c=d', { a: true, c: 'd' });
checkParse('a=yes ,c=d', { a: true, c: 'd' });
checkParse('a=yes, c=d', { a: true, c: 'd' });
checkParse('a=yes , c=d', { a: true, c: 'd' });
checkParse(' a=yes , c=d', { a: true, c: 'd' });
checkParse(' a= yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c=d', { a: true, c: 'd' });
checkParse(' a = yes , c =d', { a: true, c: 'd' });
checkParse(' a = yes , c = d', { a: true, c: 'd' });
checkParse(' a = yes , c = d ', { a: true, c: 'd' });
});
});