mirror of
https://github.com/iconify/iconify.git
synced 2024-12-14 14:38:25 +00:00
36 lines
883 B
TypeScript
36 lines
883 B
TypeScript
|
import { updateStyle } from '../src/render/style';
|
||
|
import {
|
||
|
cleanupGlobals,
|
||
|
expectedBlock,
|
||
|
expectedInline,
|
||
|
setupDOM,
|
||
|
} from './helpers';
|
||
|
|
||
|
describe('Testing rendering style', () => {
|
||
|
afterEach(cleanupGlobals);
|
||
|
|
||
|
it('updateStyle', () => {
|
||
|
// Setup DOM
|
||
|
const doc = setupDOM('').window.document;
|
||
|
|
||
|
// Create container node
|
||
|
const node = doc.createElement('div');
|
||
|
|
||
|
// Add style to empty parent
|
||
|
updateStyle(node, false);
|
||
|
expect(node.innerHTML).toBe('<style>' + expectedBlock + '</style>');
|
||
|
|
||
|
// Change inline mode
|
||
|
updateStyle(node, true);
|
||
|
expect(node.innerHTML).toBe('<style>' + expectedInline + '</style>');
|
||
|
|
||
|
// Do not change anything
|
||
|
updateStyle(node, true);
|
||
|
expect(node.innerHTML).toBe('<style>' + expectedInline + '</style>');
|
||
|
|
||
|
// Change to block
|
||
|
updateStyle(node, false);
|
||
|
expect(node.innerHTML).toBe('<style>' + expectedBlock + '</style>');
|
||
|
});
|
||
|
});
|