All files / ember-web-app/node-tests/unit/utils tag-builder-test.js

100% Statements 25/25
100% Branches 0/0
100% Functions 11/11
100% Lines 25/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62  1x 1x   1x 1x 1x 1x 1x 1x   1x     1x 1x   1x           1x 1x   1x             1x 1x 1x   1x     1x 1x   1x           1x 1x   1x                  
'use strict';
const assert = require('assert');
const { link, meta } = require('../../../lib/utils/tag-builder');
 
describe('Unit', function() {
  describe('utils', function() {
    describe('tag-builder', function() {
      describe('link', function() {
        it('builds empty `link` tag', function() {
          let attributes = {};
 
          assert.strictEqual(link(attributes), '<link>');
        });
 
        it('builds `link` tag with attributes', function() {
          let attributes = { rel: 'icon', href: 'foo.png' };
 
          assert.strictEqual(
            link(attributes),
            '<link rel="icon" href="foo.png">'
          );
        });
 
        it('builds `link` tag with attributes and skips falsy', function() {
          let attributes = { rel: 'icon', href: 'foo.png', sizes: '' };
 
          assert.strictEqual(
            link(attributes),
            '<link rel="icon" href="foo.png">'
          );
        });
      });
 
      describe('meta', function() {
        it('builds empty `meta` tag', function() {
          let attributes = {};
 
          assert.strictEqual(meta(attributes), '<meta>');
        });
 
        it('builds `meta` tag with attributes', function() {
          let attributes = { name: 'icon', content: 'foo.png' };
 
          assert.strictEqual(
            meta(attributes),
            '<meta name="icon" content="foo.png">'
          );
        });
 
        it('builds `meta` tag with attributes and skips falsy', function() {
          let attributes = { name: 'icon', content: 'foo.png', sizes: '' };
 
          assert.strictEqual(
            meta(attributes),
            '<meta name="icon" content="foo.png">'
          );
        });
      });
    });
  });
});