本文整理汇总了TypeScript中reducers/app.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test('allow new priority notification to trump existing ones', () => {
let state = appInitialState;
state = reducer(
state,
openNotification('New notification', {
overwritable: true,
priority: true,
}),
);
// Expect overwritable priority notification to be overwritten
state = reducer(state, openNotification('Second notification'));
expect(state.notifications).toHaveLength(1);
expect(state.notifications[0]).toMatchObject({ message: 'Second notification' });
// Expect priority notification to be inserted at the front of the queue
const pNotif3 = { message: 'Third notification', priority: true };
state = reducer(state, openNotification(pNotif3.message, { priority: pNotif3.priority }));
expect(state.notifications).toHaveLength(2);
expect(state.notifications[0]).toMatchObject(pNotif3);
// Expect new, overwritable, priority notification to be discarded
// if non-overwritable notification is in line
state = reducer(
state,
openNotification('Fourth notification', {
overwritable: true,
priority: true,
}),
);
expect(state.notifications).toHaveLength(2);
expect(state.notifications[0]).toMatchObject(pNotif3);
});
开发者ID:nusmodifications,项目名称:nusmods,代码行数:33,代码来源:app.test.ts
示例2: modifyLesson
test('app should set active lesson', () => {
const anotherLesson: Lesson = lessons[1];
const action: FSA = modifyLesson(anotherLesson);
const nextState: AppState = reducer(appHasActiveLessonState, action);
expect(nextState).toEqual({ ...appInitialState, activeLesson: anotherLesson });
});
开发者ID:nusmodifications,项目名称:nusmods,代码行数:7,代码来源:app.test.ts
示例3: reducer
test('app should subscribe to online status action', () => {
const nextState = reducer(appInitialState, setOnlineStatus(false));
expect(nextState).toHaveProperty('isOnline', false);
expect(reducer(nextState, setOnlineStatus(true))).toHaveProperty('isOnline', true);
});
开发者ID:nusmodifications,项目名称:nusmods,代码行数:5,代码来源:app.test.ts
示例4: changeLesson
test('app should accept lesson change and unset active lesson', () => {
const action: FSA = changeLesson(semester, lesson);
const nextState: AppState = reducer(appInitialState, action);
expect(nextState).toEqual(appInitialState);
});
开发者ID:nusmodifications,项目名称:nusmods,代码行数:6,代码来源:app.test.ts
示例5: selectSemester
test('app should set active semester', () => {
const action: FSA = selectSemester(anotherSemester);
const nextState: AppState = reducer(appInitialState, action);
expect(nextState).toEqual(appHasSemesterTwoState);
});
开发者ID:nusmodifications,项目名称:nusmods,代码行数:6,代码来源:app.test.ts
注:本文中的reducers/app.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论