From 11ac435465094461f55ad01afcd59e2934500359 Mon Sep 17 00:00:00 2001 From: Ted Clancy Date: Fri, 28 Aug 2015 03:31:36 -0700 Subject: [PATCH] Bug 1178484 - Part 5: Test for metachange event when Open Graph property is loaded. r=kanru --- .../mochitest/browserElement_Metachange.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dom/browser-element/mochitest/browserElement_Metachange.js b/dom/browser-element/mochitest/browserElement_Metachange.js index 88edd0d84032..7789a3e18c0c 100644 --- a/dom/browser-element/mochitest/browserElement_Metachange.js +++ b/dom/browser-element/mochitest/browserElement_Metachange.js @@ -24,6 +24,10 @@ function createMetaWithLang(name, content, lang) { return ''; } +function createMetaWithProperty(property, content) { + return ''; +} + 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 {