Skip to content

Commit

Permalink
Improve test structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mati365 committed Jan 13, 2025
1 parent 8742690 commit 2ebd5ab
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions packages/ckeditor5-utils/tests/collectstylesheets.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,24 @@
import collectStylesheets from '../src/collectstylesheets.js';

describe( 'collectStylesheets', () => {
const dataCkeStylesheet = document.createElement( 'style' );
dataCkeStylesheet.setAttribute( 'data-cke', true );
dataCkeStylesheet.id = 'data-cke-stylesheet';
dataCkeStylesheet.append( `
:root {
--variable: white;
}
.ck-content { color: black }
.some-styles { color: red }
` );

const stylesheet = document.createElement( 'style' );
stylesheet.id = 'stylesheet';
stylesheet.append( 'h2 { color: black }' );

before( async () => {
for ( const style of document.styleSheets ) {
document.head.removeChild( style.ownerNode );
}
} );
let dataCkeStylesheet, stylesheet;

beforeEach( async () => {
dataCkeStylesheet = document.createElement( 'style' );
dataCkeStylesheet.setAttribute( 'data-cke', true );
dataCkeStylesheet.id = 'data-cke-stylesheet';
dataCkeStylesheet.append( `
:root {
--variable: white;
}
.ck-content { color: black }
.some-styles { color: red }
` );

stylesheet = document.createElement( 'style' );
stylesheet.id = 'stylesheet';
stylesheet.append( 'h2 { color: black }' );

document.head.appendChild( dataCkeStylesheet );
document.head.appendChild( stylesheet );

Expand Down

0 comments on commit 2ebd5ab

Please sign in to comment.