Skip to content

Commit

Permalink
Added example
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Aldenhoven committed Oct 28, 2022
1 parent cd6ed0d commit 95d89b6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/runtime/test/bootstrap-lazy.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { bootstrapLazy } from '../bootstrap-lazy';
import { doc } from '@platform';


describe('assets', () => {


it('should not append broken css', async () => {
const spy = jest.spyOn(doc.head, 'insertBefore');

/**
* To make the test shorter I called bootstrapLazy without any bundles
* When a user call defineCustomElements multiple times it will prevent defining the same elements within
* the bootstrapLazy method. Although this works it does still add the broken css.
*/
bootstrapLazy([]);

expect(spy).not.toHaveBeenCalledWith(expect.objectContaining({
sheet: expect.objectContaining({
cssRules: [expect.objectContaining({
// This html is not valid since it does not start with a selector for the visibility hidden block
cssText: '{visibility:hidden}.hydrated{visibility:inherit}'
})]
})
}), null);
});
});

0 comments on commit 95d89b6

Please sign in to comment.