This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.views.generic.base import View, TemplateResponseMixin | |
from django.views.generic.edit import FormMixin, ProcessFormView | |
class MultipleFormsMixin(FormMixin): | |
""" | |
A mixin that provides a way to show and handle several forms in a | |
request. | |
""" | |
form_classes = {} # set the form classes as a mapping |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* =========================================================== | |
* bootstrap-datepicker.js v1.3.0 | |
* http://twitter.github.com/bootstrap/javascript.html#datepicker | |
* =========================================================== | |
* Copyright 2011 Twitter, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useGlobal } from 'reactn'; | |
import Card from './Card' | |
const Cards = () => { | |
const [cards, setCards] = useGlobal('cards'); | |
return ( | |
<div> | |
{cards.map(card => ( | |
<Card key={card} card={card} />))} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { shallow } from 'enzyme'; | |
import { useGlobal } from 'reactn'; | |
import Cards from './cards'; | |
jest.mock('reactn'); | |
it('should render a Card component for each global state card', () => { | |
const cards = ['Q', 'J', 'K', 'A', '2']; | |
useGlobal.mockReturnValueOnce([cards]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('Cards component, supposing that uses redux', () => { | |
const props = StoreFactory({ ...customConditions }); | |
const wrapper = shallow(<Cards {...props} />); | |
expect(wrapper).toMatchSnapshot(); | |
expect(wrapper.find(something)).toEqual(whatImExpecting); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports[`should render a Card component for each global state card 1`] = ` | |
<div> | |
<Card card="Q" key="Q" /> | |
<Card card="J" key="J" /> | |
<Card card="K" key="K" /> | |
<Card card="A" key="A" /> | |
<Card card="2" key="2" /> | |
</div> | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const useGlobal = jest.fn(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [global, setGlobal] = useGlobal(); | |
useGlobal.mockReturnValueOnce([mockedGlobal, jest.fn()]); | |
const reducerFunc = useGlobal('someReducerFunc'); | |
useGlobal.mockReturnValueOnce(mockedReducerFunc); |
OlderNewer