Created
April 16, 2015 20:50
-
-
Save zxqx/43f5452d64864eca91bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import angular from 'angular'; | |
import angularMocks from 'angular-mocks'; | |
import choosePageTemplate from './index.js'; | |
describe('choose page template directive', function () { | |
var $scope, element; | |
beforeEach(angular.mock.module('w2o.nextworks.choosePageTemplate')); | |
beforeEach(angular.mock.inject(function($compile, $rootScope) { | |
$scope = $rootScope; | |
element = angular.element('<div choose-page-template></div>'); | |
$compile(element)($scope); | |
$scope.$digest(); | |
})); | |
it('should be valid', function() { | |
$scope.settings = {}; | |
$scope.settings.template = '1-column-simple'; | |
element.scope().$apply(); | |
expect($scope.valid).toBe(true); | |
}); | |
it('should have added a style class to the selected template', function() { | |
$scope.settings = {}; | |
$scope.settings.template = '1-column-simple'; | |
element.scope().$apply(); | |
expect(element[0].querySelector('.selected') instanceof HTMLElement).toBe(true); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment