本文整理汇总了TypeScript中@angular/platform-browser.Meta.getTags方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Meta.getTags方法的具体用法?TypeScript Meta.getTags怎么用?TypeScript Meta.getTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/platform-browser.Meta
的用法示例。
在下文中一共展示了Meta.getTags方法的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: 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);
});
示例3: it
it('should return all meta tags matching selector', () => {
const tag1 = metaService.addTag({name: 'author', content: 'page author'}) !;
const tag2 = metaService.addTag({name: 'author', content: 'another page author'}) !;
const actual: HTMLMetaElement[] = metaService.getTags('name=author');
expect(actual.length).toEqual(2);
expect(getDOM().getAttribute(actual[0], 'content')).toEqual('page author');
expect(getDOM().getAttribute(actual[1], 'content')).toEqual('another page author');
// clean up
metaService.removeTagElement(tag1);
metaService.removeTagElement(tag2);
});