Skip to content

Instantly share code, notes, and snippets.

View anthanh's full-sized avatar
👾
Cooking some magic stuff

Anthanh anthanh

👾
Cooking some magic stuff
View GitHub Profile
@anthanh
anthanh / app.component.ts
Last active December 12, 2017 23:38
Angular 5 with Universal and TransferState: TransferState Support
// app.component.ts
...
import { TransferState, makeStateKey } from '@angular/platform-browser';
const PHOTOS = makeStateKey('photos');
@Component({...})
export class AppComponent implements OnInit {
opened: boolean;
photos: any[];
@anthanh
anthanh / regex.js
Created November 25, 2018 22:56
angular ssr rendered styles regex
const stylesRegexp = /<style ng-transition="thor">(.*?(\n))+.*?<\/style>/g
describe('formatNumber function', () => {
it('works with strings', () => {
const formatted = formatNumber('12.45')
expect(formatted).toEqual('12,45')
})
it('works with numbers', () => {
const formatted = formatNumber(12.45)
describe('<PriceCard />', () => {
it('renders <PriceCard /> component', async () => {
const { container } = render(
<PriceCard data={mockData} onAddToCart={() => {}} />
)
expect(container).toMatchSnapshot()
})
})
describe('On submit form', () => {
it('the popover is rendered', async () => {
const store = createStore()
const { container, getByText, getByTestId } = render(
<ReduxProvider store={store}>
<CheckCoverageContainer />
</ReduxProvider>
)
storiesOf('my-front/UI/Button', module)
.add('Button', () => <ButtonsSet />)
.add('Button Link', () => (
<>
<Button
variant="contained"
component="a"
href="https://google.es"
target="_blank"
{
"data": [
"http://www.homerswebpage.com/",
"https://etereo.io/"
]
}