本文整理匯總了TypeScript中@angular/platform-browser.Meta類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Meta類的具體用法?TypeScript Meta怎麽用?TypeScript Meta使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Meta類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should not add meta tag if it is already present on the page and has the same attr', () => {
expect(metaService.getTags('property="fb:app_id"').length).toEqual(1);
metaService.addTag({property: 'fb:app_id', content: '123456789'});
expect(metaService.getTags('property="fb:app_id"').length).toEqual(1);
});
示例2: it
it('should extract selector from the tag definition', () => {
const selector = 'property="fb:app_id"';
metaService.updateTag({property: 'fb:app_id', content: '666'});
const actual = metaService.getTag(selector);
expect(actual).not.toBeNull();
expect(getDOM().getAttribute(actual, 'content')).toEqual('666');
});
示例3: expect
() => {
expect(metaService.getTags('property="fb:app_id"').length).toEqual(1);
const meta = metaService.addTag({property: 'fb:app_id', content: '666'});
expect(metaService.getTags('property="fb:app_id"').length).toEqual(2);
// clean up
metaService.removeTagElement(meta);
});