heat-dashboard/heat_dashboard/static/dashboard/project/heat_dashboard/template_generator/js/components/compile.directive.spec.js
Xinni Ge 52f2e318ad Add unittests for template generator angular
The following changes have been made.
 - Test cases for common components and individual resources.
 - Setup karma + jasmine test environment.
 - Setup eslint environment and rules.
 - Code style adjustment to satisfiy eslint rules.

Change-Id: Icb3e48be11beaebc4e410644c62e0df86b345207
2017-10-26 09:55:53 +09:00

30 lines
897 B
JavaScript

(function() {
'use strict';
describe('hotgen-utils compile directive', function(){
beforeEach(module('hotgen-utils'));
var $compile, $rootScope, $scope, $isolateScope, element;
beforeEach(inject(function($rootScope, $compile) {
$scope = $rootScope.$new();
// element will enable you to test your directive's element on the DOM
element = $compile(angular.element('<div compile="<h1>Compile Me</h1>"></div>'))($scope);
// Digest needs to be called to set any values on the directive's scope
$scope.$digest();
// If the directive uses isolate scope, we need to get a reference to it
// explicitly
}));
it('Replaces the element with the appropriate content', function() {
expect(element.html()).toContain("Compile Me");
});
});
})();