UNPKG

1.08 kBJavaScriptView Raw
1/*global inject*/
2import 'angular';
3import 'angular-mocks';
4
5import styles from '../loader-inline/loader-inline.css';
6
7import LoaderInline from './loader-inline-ng';
8
9describe('LoaderInline', () => {
10 let element;
11 let scope;
12 let $compile;
13
14 beforeEach(window.module(LoaderInline));
15
16 beforeEach(inject(($rootScope, _$compile_) => {
17 scope = $rootScope.$new();
18 $compile = _$compile_;
19 element = $compile('<rg-loader-inline></rg-loader-inline>')(scope)[0];
20 scope.$digest();
21 }));
22
23 it('should render loader markup', () => {
24 element.should.contain(`.${styles.loader}`);
25 element.should.contain(`.${styles.loader}_light`);
26 element.should.contain('[data-test="ring-loader-inline-ng"]');
27 });
28
29 it('should render light loader theme by default', () => {
30 element.should.contain(`.${styles.loader}_light`);
31 });
32
33 it('should render dark loader theme if passed', () => {
34 element = $compile('<rg-loader-inline theme="dark"></rg-loader-inline>')(scope)[0];
35 scope.$digest();
36 element.should.contain(`.${styles.loader}_dark`);
37 });
38
39});