mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
added timepicker test skeleton
This commit is contained in:
parent
de9c7970c5
commit
97482bd222
4 changed files with 74 additions and 6 deletions
|
@ -1,10 +1,10 @@
|
|||
module.exports = function (grunt) {
|
||||
/* jshint scripturl:true */
|
||||
grunt.registerTask('test', [
|
||||
'jshint',
|
||||
'maybe_start_server',
|
||||
'jade',
|
||||
'mocha:unit'
|
||||
'mocha:unit',
|
||||
'jshint'
|
||||
]);
|
||||
|
||||
grunt.registerTask('coverage', [
|
||||
|
|
|
@ -48,16 +48,19 @@
|
|||
function runTests() {
|
||||
require([
|
||||
'sinon/sinon',
|
||||
'specs/apps/dashboard/directives/panel',
|
||||
//'specs/apps/dashboard/directives/panel',
|
||||
'specs/directives/timepicker',
|
||||
'specs/utils/datemath',
|
||||
'specs/utils/interval',
|
||||
'specs/courier/index'
|
||||
], function (sinon) {
|
||||
|
||||
var xhr = sinon.useFakeXMLHttpRequest();
|
||||
|
||||
/*
|
||||
xhr.onCreate = function () {
|
||||
throw new Error('Tests should not be sending XHR requests');
|
||||
};
|
||||
*/
|
||||
|
||||
window.mochaRunner = mocha.run().on('end', function () {
|
||||
window.mochaResults = this.stats;
|
||||
|
|
|
@ -8,13 +8,20 @@ define(function (require) {
|
|||
require('angular-route');
|
||||
|
||||
// Load the code for the directive
|
||||
require('apps/dashboard/directives/panel');
|
||||
require('index');
|
||||
require('apps/visualize/index');
|
||||
require('apps/dashboard/index');
|
||||
|
||||
// TODO: This should not be needed, timefilter is only included here
|
||||
require('apps/discover/index');
|
||||
|
||||
|
||||
describe('Dashboard panels', function () {
|
||||
var $scope, $elem;
|
||||
|
||||
beforeEach(function () {
|
||||
module('app/dashboard');
|
||||
|
||||
module('kibana');
|
||||
|
||||
// Create the scope
|
||||
inject(function ($rootScope, $compile) {
|
||||
|
|
58
test/unit/specs/directives/timepicker.js
Normal file
58
test/unit/specs/directives/timepicker.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
define(function (require) {
|
||||
var angular = require('angular');
|
||||
var mocks = require('angular-mocks');
|
||||
var moment = require('moment');
|
||||
var _ = require('lodash');
|
||||
var $ = require('jquery');
|
||||
var sinon = require('sinon/sinon');
|
||||
|
||||
|
||||
// Load the kibana app dependencies.
|
||||
require('angular-route');
|
||||
|
||||
// Load the code for the directive
|
||||
require('index');
|
||||
require('apps/visualize/index');
|
||||
require('apps/dashboard/index');
|
||||
|
||||
// TODO: This should not be needed, timefilter is only included here
|
||||
require('apps/discover/index');
|
||||
|
||||
|
||||
describe('Modes', function () {
|
||||
var $scope, $elem;
|
||||
var clock, anchor = '2014-01-01T06:06:06.666Z';
|
||||
|
||||
beforeEach(function () {
|
||||
// Need some module, doesn't matter which really
|
||||
module('kibana');
|
||||
|
||||
clock = sinon.useFakeTimers(moment(anchor).valueOf());
|
||||
|
||||
// Create the scope
|
||||
inject(function ($rootScope, $compile) {
|
||||
|
||||
$scope = $rootScope;
|
||||
|
||||
$scope.time = {
|
||||
from: moment().subtract(15, 'minutes'),
|
||||
to: moment()
|
||||
};
|
||||
|
||||
$elem = angular.element(
|
||||
'<kbn-timepicker from="time.from" to="time.to"></kbn-timepicker>'
|
||||
);
|
||||
|
||||
$compile($elem)($scope);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('should contain something', function (done) {
|
||||
expect($elem.text().length).to.be.above(1);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue