github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/webapp/components/test/product-info.html (about) 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <script src="../../node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script> 6 <script src="../../node_modules/wct-browser-legacy/browser.js"></script> 7 </head> 8 <body> 9 <dom-module id="product-info-concrete"> 10 <script type="module"> 11 import { PolymerElement } from '../../node_modules/@polymer/polymer/polymer-element.js'; 12 import { ProductInfo } from '../product-info.js'; 13 14 class ConcreteProductInfo extends ProductInfo(PolymerElement) {} 15 window.customElements.define('product-info-concrete', ConcreteProductInfo); 16 </script> 17 </dom-module> 18 19 <test-fixture id="product-info-fixture"> 20 <template> 21 <product-info-concrete></product-info-concrete> 22 </template> 23 </test-fixture> 24 25 <script type="module"> 26 suite('ProductInfo', () => { 27 let productInfo; 28 29 setup(() => { 30 productInfo = fixture('product-info-fixture'); 31 }); 32 33 test('displayName', () => { 34 expect(productInfo.displayName('chrome')).to.equal('Chrome'); 35 expect(productInfo.displayName('chrome-experimental')).to.equal('Chrome'); 36 expect(productInfo.displayName('uc')).to.equal('UC Browser'); 37 expect(productInfo.displayName('unknown-browser')).to.equal('unknown-browser'); 38 }); 39 40 test('displayLabels', () => { 41 expect(productInfo.displayLabels(undefined)).to.equal(''); 42 expect(productInfo.displayLabels(['foo', 'bar'])).to.equal('foo, bar'); 43 }); 44 45 test('displayMetadataLogo', () => { 46 expect(productInfo.displayMetadataLogo('')).to.equal('/static/wpt_64x64.png'); 47 expect(productInfo.displayMetadataLogo('chrome')).to.equal('/static/chrome_64x64.png'); 48 }); 49 50 test('displayLogo', () => { 51 expect(productInfo.displayLogo(undefined, undefined)).to.equal(undefined); 52 expect(productInfo.displayLogo('browser', undefined)).to.equal('/static/browser_64x64.png'); 53 expect(productInfo.displayLogo('servo', ['nightly'])).to.equal('/static/servo_64x64.png'); 54 expect(productInfo.displayLogo('chrome', ['nightly'])).to.equal('/static/chromium_64x64.png'); 55 expect(productInfo.displayLogo('chrome', ['dev'])).to.equal('/static/chrome-dev_64x64.png'); 56 expect(productInfo.displayLogo('firefox', ['stable'])).to.equal('/static/firefox_64x64.png'); 57 }); 58 }); 59 </script> 60 </body> 61 </html>