Matteo Scandolo | 23131c0 | 2016-04-22 11:02:58 -0700 | [diff] [blame^] | 1 | /** |
| 2 | * © OpenCORD |
| 3 | * |
| 4 | * Created by teone on 4/15/16. |
| 5 | */ |
| 6 | |
| 7 | (function () { |
| 8 | 'use strict'; |
| 9 | |
| 10 | describe('The xos.helper module', function(){ |
| 11 | describe('The xos-validation component', () => { |
| 12 | |
| 13 | let element, scope, isolatedScope; |
| 14 | |
| 15 | beforeEach(module('xos.helpers')); |
| 16 | |
| 17 | beforeEach(inject(($compile, $rootScope) => { |
| 18 | |
| 19 | scope = $rootScope.$new(); |
| 20 | |
| 21 | scope.errors = {}; |
| 22 | |
| 23 | element = angular.element(`<xos-validation errors="errors"></xos-validation>`); |
| 24 | $compile(element)(scope); |
| 25 | scope.$digest(); |
| 26 | isolatedScope = element.isolateScope().vm; |
| 27 | })); |
| 28 | |
| 29 | it('should not show an alert', () => { |
| 30 | expect($(element).find('xos-alert > .alert')[0]).toHaveClass('ng-hide'); |
| 31 | }); |
| 32 | |
| 33 | it('should show an alert', () => { |
| 34 | scope.errors.email = true; |
| 35 | scope.$digest(); |
| 36 | expect($(element).find('xos-alert > .alert')[0]).not.toHaveClass('ng-hide'); |
| 37 | }); |
| 38 | }); |
| 39 | }); |
| 40 | })(); |