/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * Tests that the page data service can parse schema.org metadata into PageData. */ add_task(async function test_single_product_microdata() { await verifyPageData( ` Product Info 1
Mr. Nested Name
Mozilla
£3.50
The most amazing microwave in the world
`, { siteName: "Mozilla", description: "The most amazing microwave in the world", image: BASE_URL + "/bon-echo-microwave-17in.jpg", data: { [PageDataSchema.DATA_TYPE.PRODUCT]: { name: "Bon Echo Microwave", price: { value: 3.5, currency: "GBP", }, }, }, } ); }); add_task(async function test_single_product_json_ld() { await verifyPageData( ` `, { siteName: "Mozilla", description: "The most amazing microwave in the world", image: BASE_URL + "/bon-echo-microwave-17in.jpg", data: { [PageDataSchema.DATA_TYPE.PRODUCT]: { name: "Bon Echo Microwave", price: { value: 3.5, currency: "GBP", }, }, }, } ); }); add_task(async function test_single_product_combined() { await verifyPageData( `
Mr. Nested Name
Mozilla
`, { siteName: "Mozilla", description: "The most amazing microwave in the world", image: BASE_URL + "/bon-echo-microwave-17in.jpg", data: { [PageDataSchema.DATA_TYPE.PRODUCT]: { name: "Bon Echo Microwave", price: { value: 3.5, currency: "GBP", }, }, }, } ); }); add_task(async function test_single_multiple_microdata() { await verifyPageData( ` Product Info 2
£3.28
`, { image: BASE_URL + "/bon-echo-microwave-17in.jpg", data: { [PageDataSchema.DATA_TYPE.PRODUCT]: { name: "Bon Echo Microwave", price: { value: 3.28, currency: "GBP", }, }, }, } ); });