mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Removing the input-whole-number, no longer used.
This commit is contained in:
parent
da04e108de
commit
cccb3708c6
4 changed files with 2 additions and 69 deletions
|
@ -1,5 +1,5 @@
|
|||
import moment from 'moment';
|
||||
import 'ui/directives/input_whole_number';
|
||||
|
||||
export default function IntervalOptionsService(Private) {
|
||||
|
||||
// shorthand
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import angular from 'angular';
|
||||
import expect from 'expect.js';
|
||||
import ngMock from 'ng_mock';
|
||||
import 'ui/directives/input_whole_number';
|
||||
import 'ui/directives/input_number';
|
||||
|
||||
describe('Number input directive', function () {
|
||||
let $compile;
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
import angular from 'angular';
|
||||
import expect from 'expect.js';
|
||||
import ngMock from 'ng_mock';
|
||||
import 'ui/directives/input_whole_number';
|
||||
|
||||
describe('Whole number input directive', function () {
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
let html = '<input type="text" ng-model="value" input-whole-number />';
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
beforeEach(ngMock.inject(function (_$compile_, _$rootScope_) {
|
||||
$compile = _$compile_;
|
||||
$rootScope = _$rootScope_;
|
||||
}));
|
||||
|
||||
it('should allow whole numbers', function () {
|
||||
let element = $compile(html)($rootScope);
|
||||
|
||||
$rootScope.value = '123';
|
||||
$rootScope.$digest();
|
||||
expect(element.hasClass('ng-valid')).to.be.ok();
|
||||
|
||||
$rootScope.value = '1.0';
|
||||
$rootScope.$digest();
|
||||
expect(element.hasClass('ng-valid')).to.be.ok();
|
||||
|
||||
$rootScope.value = '-5.0';
|
||||
$rootScope.$digest();
|
||||
expect(element.hasClass('ng-valid')).to.be.ok();
|
||||
});
|
||||
|
||||
it('should disallow numbers with decimals', function () {
|
||||
let element = $compile(html)($rootScope);
|
||||
|
||||
$rootScope.value = '123.0';
|
||||
$rootScope.$digest();
|
||||
expect(element.hasClass('ng-valid')).to.be.ok();
|
||||
|
||||
$rootScope.value = '1.2';
|
||||
$rootScope.$digest();
|
||||
expect(element.hasClass('ng-invalid')).to.be.ok();
|
||||
|
||||
$rootScope.value = '-5.5';
|
||||
$rootScope.$digest();
|
||||
expect(element.hasClass('ng-invalid')).to.be.ok();
|
||||
});
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
import uiModules from 'ui/modules';
|
||||
let module = uiModules.get('kibana');
|
||||
|
||||
module.directive('inputWholeNumber', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function ($scope, $elem, attrs, ngModel) {
|
||||
ngModel.$parsers.push(checkWholeNumber);
|
||||
ngModel.$formatters.push(checkWholeNumber);
|
||||
|
||||
function checkWholeNumber(value) {
|
||||
ngModel.$setValidity('whole', value % 1 === 0);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue