Browse Source

Update parser tests

pull/4746/head
Artur Arseniev 4 years ago
parent
commit
e417e22824
  1. 23
      test/specs/parser/model/ParserCss.js
  2. 6
      test/specs/parser/model/ParserHtml.js

23
test/specs/parser/model/ParserCss.js

@ -5,15 +5,14 @@ describe('ParserCss', () => {
let obj; let obj;
let config; let config;
let customParser; let customParser;
let em = {
getCustomParserCss: () => customParser,
trigger: () => {},
};
beforeEach(() => { beforeEach(() => {
config = { config = {};
em: { obj = new ParserCss(em, config);
getCustomParserCss: () => customParser,
trigger: () => {},
},
};
obj = new ParserCss(config);
}); });
afterEach(() => { afterEach(() => {
@ -272,7 +271,7 @@ describe('ParserCss', () => {
selectors: [], selectors: [],
selectorsAdd: '', selectorsAdd: '',
atRuleType: 'font-face', atRuleType: 'font-face',
singleAtRule: 1, singleAtRule: true,
style: { 'font-family': '"Open Sans"' }, style: { 'font-family': '"Open Sans"' },
}; };
expect(obj.parse(str)).toEqual([result]); expect(obj.parse(str)).toEqual([result]);
@ -292,7 +291,7 @@ describe('ParserCss', () => {
selectors: [], selectors: [],
selectorsAdd: '', selectorsAdd: '',
style: { 'font-family': '"Open Sans"' }, style: { 'font-family': '"Open Sans"' },
singleAtRule: 1, singleAtRule: true,
atRuleType: 'font-face', atRuleType: 'font-face',
}, },
{ {
@ -302,7 +301,7 @@ describe('ParserCss', () => {
'font-family': "'Glyphicons Halflings'", 'font-family': "'Glyphicons Halflings'",
src: 'url(https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot)', src: 'url(https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot)',
}, },
singleAtRule: 1, singleAtRule: true,
atRuleType: 'font-face', atRuleType: 'font-face',
}, },
]; ];
@ -345,7 +344,7 @@ describe('ParserCss', () => {
selectors: ['test1'], selectors: ['test1'],
style: { color: 'blue' }, style: { color: 'blue' },
}; };
obj = new ParserCss({ obj = new ParserCss(em, {
parserCss: () => [result], parserCss: () => [result],
}); });
expect(obj.parse(str)).toEqual([result]); expect(obj.parse(str)).toEqual([result]);
@ -379,7 +378,7 @@ describe('ParserCss', () => {
{ {
style: style, style: style,
atRuleType: 'font-face', atRuleType: 'font-face',
singleAtRule: 1, singleAtRule: true,
selectors: [], selectors: [],
}, },
]); ]);

6
test/specs/parser/model/ParserHtml.js

@ -9,7 +9,7 @@ describe('ParserHtml', () => {
beforeEach(() => { beforeEach(() => {
const em = new Editor({}); const em = new Editor({});
var dom = new DomComponents(em); var dom = new DomComponents(em);
obj = new ParserHtml({ obj = new ParserHtml(em, {
textTags: ['br', 'b', 'i', 'u'], textTags: ['br', 'b', 'i', 'u'],
pStylePrefix: 'gjs-', pStylePrefix: 'gjs-',
returnArray: 1, returnArray: 1,
@ -409,7 +409,7 @@ describe('ParserHtml', () => {
'font-family': '"Open Sans"', 'font-family': '"Open Sans"',
src: 'url(https://fonts.gstatic.com/s/droidsans/v8/SlGVmQWMvZQIdix7AFxXkHNSbRYXags.woff2)', src: 'url(https://fonts.gstatic.com/s/droidsans/v8/SlGVmQWMvZQIdix7AFxXkHNSbRYXags.woff2)',
}, },
singleAtRule: 1, singleAtRule: true,
atRuleType: 'font-face', atRuleType: 'font-face',
}, },
{ {
@ -419,7 +419,7 @@ describe('ParserHtml', () => {
'font-family': "'Glyphicons Halflings'", 'font-family': "'Glyphicons Halflings'",
src: 'url(https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot)', src: 'url(https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot)',
}, },
singleAtRule: 1, singleAtRule: true,
atRuleType: 'font-face', atRuleType: 'font-face',
}, },
]; ];

Loading…
Cancel
Save