github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/webapp/components/test/product-builder.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  
     8    <script type="module" src="../product-builder.js"></script>
     9  </head>
    10  <body>
    11    <test-fixture id="product-builder-fixture">
    12      <template>
    13        <product-builder></product-builder>
    14      </template>
    15    </test-fixture>
    16  
    17    <script type="module">
    18  import '../product-builder.js';
    19  
    20  suite('ProductBuilder', () => {
    21    let productBuilder;
    22  
    23    setup(() => {
    24      productBuilder = fixture('product-builder-fixture');
    25      productBuilder.product = {browser_name: 'chrome'};
    26    });
    27  
    28    suite('ProductBuilder.prototype.*', () => {
    29      suite('_channel', () => {
    30        test('updates the labels when value changes', () => {
    31          productBuilder._channel = 'stable';
    32          assert.isTrue(productBuilder.labels.includes('stable'));
    33        });
    34        test('updates the spec when value changes', () => {
    35          productBuilder._channel = 'experimental';
    36          assert.equal(productBuilder.spec, 'chrome[experimental]');
    37        });
    38        test('changes value when labels are updated', () => {
    39          productBuilder.set('labels', ['experimental']);
    40          assert.equal(productBuilder._channel, 'experimental');
    41          assert.equal(productBuilder._source, 'any');
    42  
    43          productBuilder.set('labels', ['buildbot']);
    44          assert.equal(productBuilder._source, 'buildbot');
    45          assert.equal(productBuilder._channel, 'any');
    46        });
    47      });
    48    });
    49  });
    50  
    51  </script>
    52  </body>
    53  </html>