Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(`should navigate to Home`, () => {
// Given
const wrapper = mount(
)
const createCrowdsaleComponentWrapper = wrapper.find(CreateCrowdsale)
const instance = createCrowdsaleComponentWrapper.instance()
const goToStepOneHandler = jest.spyOn(instance, 'goToStepOne')
instance.forceUpdate()
// When
storage.set('DeploymentStore', { deploymentStep: 1 })
const buttonCreateCrowdsale = createCrowdsaleComponentWrapper.find('.hm-Home_BtnNew')
buttonCreateCrowdsale.simulate('click')
// Then
expect(buttonCreateCrowdsale.length).toBe(1)
expect(goToStepOneHandler).toHaveBeenCalledTimes(1)
expect(goToStepOneHandler).toHaveBeenCalledWith()
})
emptyCart = () => {
this.setState({ itemsInCart: [] });
store.set('itemsInCart', []);
};
() => store.set("mode", this.state.checked ? "dark" : "light")
)
mobx.autorun(`autorun for ${storageKey}`, () => {
if (firstRun) {
const existingStore = storage.get(storageKey)
if (existingStore) {
mobx.extendObservable(store, deserialize(existingStore))
}
firstRun = false
}
storage.set(storageKey, mobx.toJS(store))
})
}
export default state => {
store.set(state.storeId, state);
return state;
};
beforeRouteLeave (to, from, next) {
const scrollTop = document.body.scrollTop
const path = this.$route.path
if (scrollTop) ls.set(path, scrollTop)
else ls.remove(path)
next()
}
}
onFormComplete(res) {
if (res.code === 200) {
this.$store.dispatch('showMsg', {
content: '登录成功', type: "success"
})
ls.set("token", res.data)
setTimeout(() => {
window.location.href = "/admin/post"
}, 1000)
} else {
this.$store.dispatch('showMsg', res.message)
}
}
}
export function destroyLocalActions () {
const stored = store.get(KEY);
store.set(KEY, NULL);
return stored === NULL ? false : stored;
}
export function saveLocalActions (actions) {
export function saveLocalActions (actions) {
store.set(KEY, actions);
return actions;
}