<commit_before>describe('element-fullscreen template', function() {

  'use strict';

  var scope,
      template,
      html,
      content,
      Styleguide;

  beforeEach(module('sgApp'));

  beforeEach(function() {
    Styleguide = {};
    module(function($provide) {
      $provide.value('Styleguide', Styleguide);
    });
  });

  beforeEach(inject(function($rootScope) {
    scope = $rootScope.$new();
    loadTemplate();
    compileTemplate();
  }));

  function loadTemplate() {
    var req = new XMLHttpRequest();
    req.open('GET', '/view/element-fullscreen.html', false);
    req.send(null);
    template = req.responseText;
  }

  function compileTemplate() {
    inject(function($compile) {
      html = $compile(template)(scope);
      scope.$digest();
      content = html.html();
    });
  }

  function expectDirectiveWithoutValue(directive) {
    var regex = new RegExp('\\s+' + directive + '(\\s+|\\>)[^=]', 'g');
    expect(template).to.match(regex);
  }

  describe('should have directive', function() {

    it('dynamic-compile without value', function() {
      expectDirectiveWithoutValue('dynamic-compile');
    });

    it('sg-scope-user-styles without value', function() {
      expectDirectiveWithoutValue('sg-scope-user-styles');
    });

    it('ng-bind-html', function() {
      expect(template).to.match(/\s+ng-bind-html="/);
    });

  });

  describe('directive ng-bind-html', function() {

    it('should filter scope.markup through addWrapper and unsafe', function() {
      var dir = 'ng-bind-html="',
          start = template.indexOf(dir) + dir.length,
          value = template.substring(start, template.indexOf('"', start));
      expect(value).to.match(/markup\s*\|\s*addWrapper\s*\|\s*unsafe\s*/);
    });

  });

  describe('when commonClass is not defined', function() {

    describe('template contents should be', function() {

      it('an empty string if scope.markup is not set', function() {
        expect(content).to.eql('');
      });

      it('text from scope.markup', function() {
        scope.markup = 'hello';
        compileTemplate();<commit_msg>Fix element full screen tests<commit_after>describe('element-fullscreen template', function() {

  'use strict';

  var scope,
      template,
      html,
      templateText,
      content,
      Styleguide;

  beforeEach(module('sgApp'));

  beforeEach(function() {
    Styleguide = {};
    module(function($provide) {
      $provide.value('Styleguide', Styleguide);
    });
  });

  beforeEach(inject(function($rootScope) {
    scope = $rootScope.$new();
    loadTemplate();
    compileTemplate();
  }));

  function loadTemplate() {
    var req = new XMLHttpRequest();
    req.open('GET', '/view/element-fullscreen.html', false);
    req.send(null);
    template = req.responseText;
  }

  function compileTemplate() {
    inject(function($compile) {
      html = $compile(template)(scope);
      scope.$digest();
      templateText = html.prop('outerHTML');
      content = angular.element(html.html()).html();
    });
  }

  function expectDirectiveWithoutValue(directive) {
    var regex = new RegExp('\\s+' + directive + '(\\s+|\\>)[^=]', 'g');
    expect(template).to.match(regex);
  }

  it('should be wrapped in shadow-dom element', function() {
    expect(templateText).to.match(/^<shadow-dom/);
    expect(templateText).to.match(/<\/shadow-dom>$/);
  });

  describe('should have directive', function() {

    it('dynamic-compile without value', function() {
      expectDirectiveWithoutValue('dynamic-compile');
    });

    it('ng-bind-html', function() {
      expect(template).to.match(/\s+ng-bind-html="/);
    });

  });

  describe('directive ng-bind-html', function() {

    it('should filter scope.markup through addWrapper and unsafe', function() {
      var dir = 'ng-bind-html="',
          start = template.indexOf(dir) + dir.length,
          value = template.substring(start, template.indexOf('"', start));
      expect(value).to.match(/markup\s*\|\s*addWrapper\s*\|\s*unsafe\s*/);
    });

  });

  describe('when commonClass is not defined', function() {

    describe('template contents should be', function() {

      it('an empty string if scope.markup is not set', function() {
        expect(content).to.eql('');
      });

      it('text from scope.markup', function() {
        scope.markup = 'hello';
        compileTemplate();
{'fraction_non_alphanumeric': 0.17755941499085923, 'fraction_numerical': 0.0, 'mean_word_length': 3.1175917215428033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5520845', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1299, 'n_words': 248}