我的组件测试文件中有一个这样的模拟模块
jest.mock('../../../magic/index', () => ({
navigationEnabled: () => true,
guidanceEnabled: () => true
}));
Run Code Online (Sandbox Code Playgroud)
这些函数将在我的组件的render函数中调用,以隐藏和显示一些特定的功能.
我想对这些模拟函数的返回值的不同组合拍摄快照.
假设我有一个像这样的测试用例
it('RowListItem should not render navigation and guidance options', () => {
const wrapper = shallow(
<RowListItem type="regularList" {...props} />
);
expect(enzymeToJson(wrapper)).toMatchSnapshot();
});
Run Code Online (Sandbox Code Playgroud)
运行这个测试用例我想将模块模块函数的返回值false动态更改为这样
jest.mock('../../../magic/index', () => ({
navigationEnabled: () => false,
guidanceEnabled: () => false
}));
Run Code Online (Sandbox Code Playgroud)
因为我已经导入RowListItem组件一次所以我的模拟模块不会再次导入.所以它不会改变.我怎么能解决这个问题?
在我的项目中,我必须使用动态工厂名称在角度js中创建动态工厂,如下所示
function createDynamicFactory(modId) {
return myModule.factory(modId + '-existingService', function (existingService) {
return existingService(modId);
});
}
Run Code Online (Sandbox Code Playgroud)
当我调用此函数时,我想获得具有动态名称的新工厂.不幸的是,这不起作用.我怎么能实现这个目标?以及如何动态注入我的控制器或指令?
如何使用C#从外部按钮单击查看winrt应用程序中的特定设置页面?
在javascript中我发现像这样的 WinJS.UI.SettingsFlyout.showSettings("About","/ Settings/Apache.html")
但我无法在c#中找到这个,我正在使用callisto来设置弹出窗口