Skip to content

Instantly share code, notes, and snippets.

@zxqx
Created April 16, 2015 20:50
Show Gist options
  • Save zxqx/43f5452d64864eca91bd to your computer and use it in GitHub Desktop.
Save zxqx/43f5452d64864eca91bd to your computer and use it in GitHub Desktop.
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