Add simple test for spinner

This commit is contained in:
Rashid Khan 2014-07-30 11:02:03 -07:00
parent d197f5eac9
commit 05e65b3d2d
2 changed files with 57 additions and 0 deletions

View file

@ -55,6 +55,7 @@
'specs/directives/timepicker',
'specs/directives/truncate',
'specs/directives/css_truncate',
'specs/directives/spinner',
'specs/filters/field_type',
'specs/filters/uriescape',
'specs/filters/moment',

View file

@ -0,0 +1,56 @@
define(function (require) {
var angular = require('angular');
var mocks = require('angular-mocks');
var $ = require('jquery');
// Load the kibana app dependencies.
require('angular-route');
// Load kibana and its applications
require('index');
require('apps/discover/index');
var $parentScope, $scope, $elem;
var init = function () {
// Load the application
module('kibana');
// Create the scope
inject(function ($rootScope, $compile) {
// Give us a scope
$parentScope = $rootScope;
// Create the element
$elem = angular.element(
'<span class="spinner"></span>'
);
// And compile it
$compile($elem)($parentScope);
// Fire a digest cycle
$elem.scope().$digest();
// Grab the isolate scope so we can test it
$scope = $elem.isolateScope();
});
};
describe('spinner directive', function () {
beforeEach(function () {
init();
});
it('should contain 3 divs', function (done) {
expect($elem.children('div').length).to.be(3);
done();
});
});
});