diff --git a/src/ui/public/agg_types/buckets/_interval_options.js b/src/ui/public/agg_types/buckets/_interval_options.js index f1a8f151898d2..344b7fa30b2c9 100644 --- a/src/ui/public/agg_types/buckets/_interval_options.js +++ b/src/ui/public/agg_types/buckets/_interval_options.js @@ -1,5 +1,5 @@ import moment from 'moment'; -import 'ui/directives/input_whole_number'; + export default function IntervalOptionsService(Private) { // shorthand diff --git a/src/ui/public/directives/__tests__/input_number.js b/src/ui/public/directives/__tests__/input_number.js index 5f5bb53828c30..6592ab76174a0 100644 --- a/src/ui/public/directives/__tests__/input_number.js +++ b/src/ui/public/directives/__tests__/input_number.js @@ -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; diff --git a/src/ui/public/directives/__tests__/input_whole_number.js b/src/ui/public/directives/__tests__/input_whole_number.js deleted file mode 100644 index 0d97c28dfd767..0000000000000 --- a/src/ui/public/directives/__tests__/input_whole_number.js +++ /dev/null @@ -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 = ''; - - 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(); - }); -}); diff --git a/src/ui/public/directives/input_whole_number.js b/src/ui/public/directives/input_whole_number.js deleted file mode 100644 index 5a4f406ea5a9f..0000000000000 --- a/src/ui/public/directives/input_whole_number.js +++ /dev/null @@ -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; - } - } - }; -});