forked from stenciljs/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcss-style-declaration.spec.ts
More file actions
32 lines (25 loc) · 1.09 KB
/
css-style-declaration.spec.ts
File metadata and controls
32 lines (25 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { MockCSSStyleDeclaration } from '../css-style-declaration';
import { MockDocument } from '../document';
import { MockHTMLElement } from '../node';
describe('css-style-declaration', () => {
let doc: MockDocument;
beforeEach(() => {
doc = new MockDocument();
});
it('should set attributes correctly', () => {
const cssAttr = new MockCSSStyleDeclaration();
cssAttr.cssText = 'color: red';
expect(cssAttr.cssText).toBe('color: red;');
});
it('should handle attributes containing colons', () => {
const cssAttr = new MockCSSStyleDeclaration();
cssAttr.cssText = 'background-image: (https://ionic.io/img/ionic-io-og-img.png);';
expect(cssAttr.cssText).toBe('background-image: (https://ionic.io/img/ionic-io-og-img.png);');
});
it('should set styles on html elements', () => {
const element = new MockHTMLElement(doc, 'div');
element.style = 'color: red; font-family: "My Custom Font"';
expect(element.style.cssText).toEqual('color: red; font-family: "My Custom Font";');
expect(element.style.cssText).toEqual(element.getAttribute('style'));
});
});