DefinitelyTyped/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts
Andy c968762595 Merge 'master' to 'types-2.0' one last time (#13277)
* Added missing nconf.required(keys) and Provider.required(keys) methods.

* update to 4.7.0, add querycursor.map() and schema.loadClass()

* add error callback for schema.post()

* Added playsInline property as introduced in React 15.3.2

* Add definitions for redux-localstorage and main enhancers (#12580)

* Add definitions for redux-localstorage

* Add definitions for redux-localstorage-filter enhancer

* Add definitions for redux-localstorage-debounce enhancer

* csurf.d.ts relying on CookieOptions from express

It seems express no longer exports `CookieOptions`, we need to import `express-serve-static-core` instead.

* Added height property to IDialogOptions

* versionKey type

* kendo-ui: mark toString() params as optional (#13164)

These function parameters are optional according to the upstream
docs, e.g.
  http://docs.telerik.com/kendo-ui/api/javascript/geometry/matrix#methods-toString

* Ensure that zoneAbbr and zoneName are expected type (string).

* Update moment-timezone.d.ts

* Fix syntax error in interact.d.ts

A parameter name was missing making TypeScript compiler fail.

* adding type for move to fs-extra

* fixing signature of sinon/alwaysReturned based on the http://sinonjs.org/docs/#sinonspy

* increasing version number

* returning back the version number to the origin number

* reversing changes in fs-extra

* Request that PRs have meaningful titles

* Improvement to existing nouislider type definition. (#12033)

* updated nouislider version and added a lot of tests out of the documentation

* corrected intentation

* corrected untyped variables, issue raised by Travis

* incorporated feedback on pull request

* #13037 (#13039)

* #13037

* pointToLayer first argument type fixed
GeoJSON.Point to GeoJSON.Feature<GeoJSON.Point>

* Missing cc in sendgrid packate (#13063)

The sendgrid package was missing the `cc` field, and the `bcc` field had a too generic type (`any` instead of `string[]`, as used on the `setCcs` and `setBccs` below.

* Fixes #12414 (#13076)

* Fixes #12414

* Make applicationServerKey optional

* added ariaLabelledBy and ariaDescribedBy to IModalSettings (#13004)

* Ceymard leaflet (#13007)

* replaced all overrides of LatLng by a single use of LatLngExpression when appropriate

* Changed Point, PointTuple overrides to use PointExpression instead

* Changet use of LatLngBounds and Bounds in general to use the Expression variant instead of having several overrides

* add ElasticSeach 5.x API function for deleteByQuery (#13014)

* add ElasticSeach 5.x API function for deleteByQuery

* use searchParams for deleteByQuery, as theses resemble the documentation.

* add DeleteByQueryParams parameter type.

* add deleteByQuery to tests.

* Make `less` render options optional (#13078)

* Added semver

* Updated gravity definition. (#13088)

* Full Redis client options (#13108)

* Added missing return type to on() methods. (#13082)

* Update react-native.0.29.d.ts (#13118)

drawerPosition is of type `number`
Android DrawerConsts.DrawerPosition.Left is equivalent to DrawerLayoutAndroid.positions.Left
Android DrawerConsts.DrawerPosition.Right is equivalent to DrawerLayoutAndroid.positions.Right

* Upgrade to match braintree-web 3.6.1 (#13098)

* Update to match braintree-web version 3.3.0

* Upgrade to match Braintree-web v3.5.0

* upgrade to match braintree-web 3.6.1

add US bank class

* Fix missing parameters from svg append (#13119)

* Add parameter declarations to append()

* Made insertFirst parameter optional

* Correct missing ‘auto’ option of GridList’s cellHeight (#13094)

* Add new Angular 1.5.9 methods to $compileProvider  (#13096)

* Add new Angular 1.5.9 methods to $compileProvider

Add new methods available in Angular 1.5.9: onChangesTtl(), commentDirectivesEnabled() and cssClassDirectivesEnabled()

* Add JSDoc to Angular 1.59 new methods of $compileProvider

JSDoc for onChangesTtl(), commentDirectivesEnabled() and cssClassDirectivesEnabled() methods.

* Expand $compileProvider JSDoc

Urls added to JSDoc of Angular 1.5.9 new methods .

* Changed type of injectedScript property to string (#13120)

The injectedScript property should take string value with script code, not the bool flag as in current version

* Use unions for openlayers string enums (#13134)

* Update google.maps.MapPane interface (#13122)

* Removing myself (AlStar01) as definition author from angular-material.d.ts (#13125)

* Clarify that notNeededPackages.json is just for packages formerly on DefinitelyTyped (#13156)

* Update Parsimmon typings (#13146)

* Update AmCharts.d.ts (#13170)

* knex: add MySqlConnectionConfig, tests (#13161)

* knex: add MySqlConnectionConfig, tests

* knex: add types for MySqlConnectionConfig queryFormat params

* Add note in readme about tsjs-lib-generator (#13210)

* Remove redux-localstorage packages; added by #13115 instead
2016-12-12 11:00:28 -08:00

277 lines
7.7 KiB
TypeScript

var testApp = angular.module('testApp');
testApp.config((
$accordionConfig: ng.ui.bootstrap.IAccordionConfig,
$buttonConfig: ng.ui.bootstrap.IButtonConfig,
$datepickerConfig: ng.ui.bootstrap.IDatepickerConfig,
$datepickerPopupConfig: ng.ui.bootstrap.IDatepickerPopupConfig,
$modalProvider: ng.ui.bootstrap.IModalProvider,
$paginationConfig: ng.ui.bootstrap.IPaginationConfig,
$pagerConfig: ng.ui.bootstrap.IPagerConfig,
$progressConfig: ng.ui.bootstrap.IProgressConfig,
$ratingConfig: ng.ui.bootstrap.IRatingConfig,
$timepickerConfig: ng.ui.bootstrap.ITimepickerConfig,
$tooltipProvider: ng.ui.bootstrap.ITooltipProvider)=> {
/**
* $accordionConfig tests
*/
$accordionConfig.closeOthers = false;
/**
* $buttonConfig tests
*/
$buttonConfig.activeClass = 'active-state';
$buttonConfig.toggleEvent = 'dblclick';
/**
* $datepickerConfig tests
*/
$datepickerConfig.datepickerMode = 'month';
$datepickerConfig.formatDay = 'd';
$datepickerConfig.formatDayHeader = 'E';
$datepickerConfig.formatDayTitle = 'dd-MM-yyyy';
$datepickerConfig.formatMonth = 'M';
$datepickerConfig.formatMonthTitle = 'yy';
$datepickerConfig.formatYear = 'y';
$datepickerConfig.maxDate = '1389586124979';
$datepickerConfig.maxMode = 'month';
$datepickerConfig.minDate = '1389586124979';
$datepickerConfig.minMode = 'month';
$datepickerConfig.shortcutPropagation = true;
$datepickerConfig.showWeeks = false;
$datepickerConfig.startingDay = 1;
$datepickerConfig.yearRange = 10;
/**
* $datepickerPopupConfig tests
*/
$datepickerPopupConfig.appendToBody = true;
$datepickerPopupConfig.currentText = 'Select Today';
$datepickerPopupConfig.clearText = 'Reset Selection';
$datepickerPopupConfig.closeOnDateSelection = false;
$datepickerPopupConfig.closeText = 'Finished';
$datepickerPopupConfig.datepickerPopup = 'dd-MM-yyyy';
$datepickerPopupConfig.datepickerPopupTemplateUrl = 'template.html';
$datepickerPopupConfig.datepickerTemplateUrl = 'template.html';
$datepickerPopupConfig.html5Types.date = 'MM-dd-yyyy';
$datepickerPopupConfig.onOpenFocus = false;
$datepickerPopupConfig.showButtonBar = false;
/**
* $modalProvider tests
*/
$modalProvider.options.animation = false;
/**
* $paginationConfig tests
*/
$paginationConfig.boundaryLinks = true;
$paginationConfig.directionLinks = false;
$paginationConfig.firstText = 'First Page';
$paginationConfig.itemsPerPage = 25;
$paginationConfig.lastText = 'Last Page';
$paginationConfig.maxSize = 13;
$paginationConfig.numPages = 13;
$paginationConfig.nextText = 'Next Page';
$paginationConfig.previousText = 'Previous Page';
$paginationConfig.rotate = false;
$paginationConfig.templateUrl = 'template.html';
$paginationConfig.totalItems = 13;
/**
* $pagerConfig tests
*/
$pagerConfig.align = false;
$pagerConfig.itemsPerPage = 25;
$pagerConfig.nextText = 'Next Page';
$pagerConfig.previousText = 'Previous Page';
/**
* $progressConfig tests
*/
$progressConfig.animate = false;
$progressConfig.max = 200;
/**
* $ratingConfig tests
*/
$ratingConfig.max = 10;
$ratingConfig.stateOff = 'rating-state-off';
$ratingConfig.stateOn = 'rating-state-on';
$ratingConfig.titles = ['1', '2', '3', '4', '5'];
/**
* $timepickerConfig tests
*/
$timepickerConfig.hourStep = 2;
$timepickerConfig.meridians = ['-AM-', '-PM-'];
$timepickerConfig.minuteStep = 5;
$timepickerConfig.mousewheel = false;
$timepickerConfig.readonlyInput = true;
$timepickerConfig.showMeridian = false;
$timepickerConfig.arrowkeys = false;
$timepickerConfig.showSpinners = false;
/**
* $tooltipProvider tests
*/
$tooltipProvider.options({
placement: 'bottom',
animation: false,
popupDelay: 1000,
appendToBody: true,
trigger: 'mouseenter hover',
useContentExp: true,
});
$tooltipProvider.setTriggers({
'customOpenTrigger': 'customCloseTrigger'
});
});
testApp.controller('TestCtrl', (
$scope: ng.ui.bootstrap.IModalScope,
$log: ng.ILogService,
$modal: ng.ui.bootstrap.IModalService,
$modalStack: ng.ui.bootstrap.IModalStackService,
$position: ng.ui.bootstrap.IPositionService,
$transition: ng.ui.bootstrap.ITransitionService)=> {
/**
* test the $modal service
*/
var modalInstance = $modal.open({
ariaLabelledBy: "label",
ariaDescribedBy: "description",
animation: false,
backdrop: 'static',
backdropClass: 'modal-backdrop-test',
bindToController: true,
controller: 'ModalTestCtrl',
controllerAs: 'vm',
keyboard: true,
openedClass: 'modal-open my-modal',
resolve: {
items: ()=> {
return [1, 2, 3, 4, 5];
}
},
scope: $scope,
template: "<div>i'm a template!</div>",
templateUrl: '/templates/modal.html',
windowClass: 'modal-test'
});
modalInstance.opened.then(()=> {
$log.log('modal opened');
});
modalInstance.rendered.then(() => {
$log.log('modal rendered');
});
modalInstance.closed.then(()=> {
$log.log('modal closed');
});
modalInstance.result.then((closeResult:any)=> {
$log.log('modal closed', closeResult);
}, (dismissResult:any)=> {
$log.log('modal dismissed', dismissResult);
});
$modal.open({
backdrop: 'static'
});
$modal.open({
templateUrl: () => '/templates/modal.html'
});
/**
* test the $modalStack service
*/
$modalStack.open(modalInstance, { scope: $scope });
$modalStack.close(modalInstance);
$modalStack.close(modalInstance, 'with reason');
$modalStack.dismiss(modalInstance);
$modalStack.dismiss(modalInstance, 'with reason');
$modalStack.dismissAll();
$modalStack.dismissAll('with reason');
$modalStack.getTop().key.close();
/**
* test the $position service
*/
var elementLogger = (coordinates: ng.ui.bootstrap.IPositionCoordinates): void=> {
$log.log('height', coordinates.height);
$log.log('left', coordinates.left);
$log.log('top', coordinates.top);
$log.log('width', coordinates.width);
};
var element = angular.element('<div/>');
elementLogger($position.position(element));
elementLogger($position.offset(element));
/**
* test the $transition service
*/
$log.log('animationEndEventName', $transition.animationEndEventName);
$log.log('transitionEndEventName', $transition.transitionEndEventName);
var transitionElement = angular.element('<div/>');
$transition(transitionElement, 'transition-class', { animation: true });
$transition(transitionElement, { height: '100px', width: '50px' }, { animation: true });
$transition(transitionElement, ()=> {}, { animation: true });
});
testApp.controller('ModalTestCtrl', (
$scope: IModalTestCtrlScope,
$log: ng.ILogService,
$modalInstance: ng.ui.bootstrap.IModalServiceInstance,
items: Array<number>)=> {
items.forEach(item=> {
$log.log(item);
});
$scope.close = ()=> {
if ($scope.useReason) {
$modalInstance.close('with reason');
} else {
$modalInstance.close();
}
};
$scope.dismiss = ()=> {
if ($scope.useReason) {
$modalInstance.dismiss('with reason');
} else {
$modalInstance.dismiss();
}
};
});
interface IModalTestCtrlScope {
useReason: boolean;
close(): void;
dismiss(): void;
}