зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1178484 - Part 5: Test for metachange event when Open Graph property is loaded. r=kanru
This commit is contained in:
Родитель
069dfd2ca0
Коммит
11ac435465
|
@ -24,6 +24,10 @@ function createMetaWithLang(name, content, lang) {
|
|||
return '<meta name="' + name + '" content="' + content + '" lang="' + lang + '">';
|
||||
}
|
||||
|
||||
function createMetaWithProperty(property, content) {
|
||||
return '<meta property="' + property + '" content="' + content + '">';
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
var iframe1 = document.createElement('iframe');
|
||||
iframe1.setAttribute('mozbrowser', 'true');
|
||||
|
@ -131,6 +135,26 @@ function runTest() {
|
|||
is(e.detail.content, 'sjs', 'content matches');
|
||||
is(e.detail.lang, 'dk', 'language matches');
|
||||
|
||||
// Test Open Graph property
|
||||
iframe1.src = createHtml(createMetaWithProperty('og:description', 'Fascinating article'));
|
||||
|
||||
// We should not get event if property doesn't start with 'og:'
|
||||
iframe3.src = createHtml(createMetaWithProperty('go:description', 'Fascinating article'));
|
||||
}
|
||||
else if (numMetaChanges == 11) {
|
||||
is(e.detail.name, 'og:description', 'property name matches');
|
||||
is(e.detail.content, 'Fascinating article', 'content matches');
|
||||
|
||||
// Sometimes 'name' is used instead of 'property'. Verify that works.
|
||||
iframe1.src = createHtml(createMeta('og:title', 'One weird trick!'));
|
||||
|
||||
// We should not get event if property doesn't start with 'og:'
|
||||
iframe3.src = createHtml(createMeta('go:title', 'One weird trick!'));
|
||||
}
|
||||
else if (numMetaChanges == 12) {
|
||||
is(e.detail.name, 'og:title', 'property name matches');
|
||||
is(e.detail.content, 'One weird trick!', 'content matches');
|
||||
|
||||
// Test the language
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче