本文整理汇总了TypeScript中models/shared/data_sharing/data_sharing_settings.DataSharingSettings类的典型用法代码示例。如果您正苦于以下问题:TypeScript DataSharingSettings类的具体用法?TypeScript DataSharingSettings怎么用?TypeScript DataSharingSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataSharingSettings类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should tell whether data sharing settings has ever been changed by admin', () => {
let settings = DataSharingSettings.fromJSON(dataSharingSettingsJSON, {getResponseHeader: () => 'ETag'});
expect(settings.hasEverChangedByAdmin()).toBe(true);
dataSharingSettingsJSON._embedded.updated_by = 'Default';
settings = DataSharingSettings.fromJSON(dataSharingSettingsJSON, {getResponseHeader: () => 'ETag'});
expect(settings.hasEverChangedByAdmin()).toBe(false);
});
开发者ID:GaneshSPatil,项目名称:gocd,代码行数:9,代码来源:data_sharing_settings_spec.ts
示例2: expect
jasmine.Ajax.withMock(() => {
const updatedMetricsSettings = {
_embedded: {
allow: false,
updated_by: "Bob"
}
};
jasmine.Ajax.stubRequest(dataSharingSettingsURL, undefined, 'PATCH').andReturn({
responseText: JSON.stringify(updatedMetricsSettings),
status: 200,
responseHeaders: {
'Content-Type': 'application/vnd.go.cd.v1+json',
'ETag': 'ETag'
}
});
const metricsSettings = DataSharingSettings.fromJSON(dataSharingSettingsJSON, {getResponseHeader: () => 'ETag'});
const successCallback = jasmine.createSpy().and.callFake(() => {
expect(metricsSettings.allowed()).toBe(updatedMetricsSettings._embedded.allow);
expect(metricsSettings.updatedBy()).toBe(updatedMetricsSettings._embedded.updated_by);
});
expect(metricsSettings.allowed()).toBe(true);
metricsSettings.toggleConsent();
expect(metricsSettings.allowed()).toBe(false);
metricsSettings.save().then(successCallback);
expect(successCallback).toHaveBeenCalled();
});
开发者ID:GaneshSPatil,项目名称:gocd,代码行数:31,代码来源:data_sharing_settings_spec.ts
注:本文中的models/shared/data_sharing/data_sharing_settings.DataSharingSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论