本文整理汇总了TypeScript中angular.IRootScopeService.%24digest方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IRootScopeService.%24digest方法的具体用法?TypeScript IRootScopeService.%24digest怎么用?TypeScript IRootScopeService.%24digest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular.IRootScopeService
的用法示例。
在下文中一共展示了IRootScopeService.%24digest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('resolves immediately for relative and non-http requests', function() {
let resolved: IRequestConfig = null;
const request: IRequestConfig = { url: '/something/relative', method: 'GET' };
interceptor.request(request).then(function(result) { resolved = result; });
$rootScope.$digest();
expect(resolved.url).toBe(request.url);
request.url = 'tcp://what.are.you.doing.here';
interceptor.request(request).then(function(result) { resolved = result; });
$rootScope.$digest();
expect(resolved.url).toBe(request.url);
});
示例2: it
it('should remove all items from the specified cache', () => {
let cache = InfrastructureCaches.get('securityGroups');
expect(cache).toBeUndefined();
cacheInitializer.initialize().then(() => {
cache = InfrastructureCaches.get('securityGroups');
expect(cache).toBeDefined();
expect(cache.keys().length).toBe(0);
const key = 'myTestCacheKey';
const value = 'myTestCacheValue';
cache.put(key, value);
expect(cache.keys().length).toBe(1);
expect(cache.get(key)).toBe(value);
cacheInitializer.refreshCache('securityGroups').then((result: any[]) => {
expect(flatten(result)).toEqual(keys.sg);
cache = InfrastructureCaches.get('securityGroups');
expect(cache.keys().length).toBe(0);
});
initialized = true;
});
$root.$digest();
expect(initialized).toBeTruthy();
});
示例3: it
it('should initialize the cache initializer with the initialization values', () => {
cacheInitializer.initialize().then((result: any[]) => {
expect(result.length).toBe(13); // from infrastructure cache config
const flattened: string[][] = flatten(result); // only the arrays that actually contain data
expect(flattened.length).toBe(4); // the four initialized string[] above used for the spyOns.
const prefixes: string[] = ['account', 'sg', 'app', 'bm'];
const foundKeys: IFoundKeys = {
account: false,
sg: false,
app: false,
bm: false,
};
// verify the contents of each array; that they match the values used for initialization
for (let i = 0; i < 4; i++) {
const item: string[] = flattened[i];
for (let j = 0; j < 4; j++) {
const prefix: string = prefixes[j];
if (item[0].startsWith(prefix)) {
expect(item).toEqual(keys[prefix]);
foundKeys[prefix] = true;
}
}
}
// finally check the boolean object to confirm each key was found
Object.keys(foundKeys).forEach((key: string) => expect(foundKeys[key]).toBeTruthy());
initialized = true;
});
$root.$digest();
expect(initialized).toBeTruthy();
});
示例4: it
it("should POST add new meeting data", () => {
const payload = {
MeetingName: "The Parlour (Basement)",
Address1: "Methodist Church",
UserName: "Meetings_PostMeeting@test.com",
Status: "ACTIVE",
Area: "LONDON",
District: "NONE",
StartTime: "13:00:00",
EndTime: "14:00:00",
LongNotes: "Tube: Bond Street or Oxford Circus\nBus: Any bus along Oxford Street",
Weekday: 3,
ShortNotes: {
NS: true,
O: false,
C: true,
MO: true,
HI: true
},
County: "London"
};
service.submitMeeting(payload);
$rootScope.$digest();
expect(dataService.getData).toHaveBeenCalledWith({
webservice: "api/meetings",
type: "POST",
payload: payload
});
});
示例5: it
it("should remove the auth cookie if logout page is visited", () => {
$location.path("/page/logout");
$rootScope.$digest();
expect(session.removeAuthCookie).toHaveBeenCalled();
});
示例6: it
it("should get data when getAllEvents is called for editor page", () => {
service.getAllEvents();
$rootScope.$digest();
expect(dataService.getData).toHaveBeenCalledWith({
webservice: "api/events",
type: "GET"
});
});