Skip to content

Commit

Permalink
Added example
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Aldenhoven authored and rwaskiewicz committed Jul 20, 2023
1 parent d6e6826 commit a57b905
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 a57b905

Please sign in to comment.