Bootstrap definitions and tests added

This commit is contained in:
Boris Yankov
2012-10-09 00:32:12 +03:00
parent cc340acda6
commit 86dacb340d
3 changed files with 148 additions and 14 deletions
+94
View File
@@ -0,0 +1,94 @@
// Type definitions for Bootstrap 2.1
// https://github.com/borisyankov/DefinitelyTyped
/// <reference path="jquery.d.ts"/>
interface ModalOptions {
backdrop?: bool;
keyboard?: bool;
show?: bool;
remote?: string;
}
interface ScrollSpyOptions {
offset?: number;
}
interface TooltipOptions {
animation?: bool;
html?: bool;
placement?: any;
selector?: string;
title?: any;
trigger?: string;
delay?: any;
}
interface PopoverOptions {
animation?: bool;
html?: bool;
placement?: any;
selector?: string;
trigger?: string;
title?: any;
content?: any;
delay?: any;
}
interface CollapseOptions {
parent?: any;
toggle?: bool;
}
interface CarouselOptions {
interval?: number;
pause?: string;
}
interface TypeaheadOptions {
source?: any;
items?: number;
minLength?: number;
matcher?: () => any;
sorter?: () => any;
highlighter?: () => any;
}
interface AffixOptions {
offset?: any;
}
interface JQuery {
modal(options?: ModalOptions): JQuery;
modal(command: string): JQuery;
dropdown(): JQuery;
scrollspy(command: string): JQuery;
scrollspy(options?: ScrollSpyOptions): JQuery;
tab(): JQuery;
tab(command: string): JQuery;
tooltip(options?: TooltipOptions): JQuery;
tooltip(command: string): JQuery;
popover(options?: PopoverOptions): JQuery;
popover(command: string): JQuery;
alert(): JQuery;
alert(command: string): JQuery;
button(): JQuery;
button(command: string): JQuery;
collapse(options?: CollapseOptions): JQuery;
collapse(command: string): JQuery;
carousel(options?: CarouselOptions): JQuery;
carousel(command: string): JQuery;
typeahead(options?: TypeaheadOptions): JQuery;
affix(options?: AffixOptions): JQuery;
}
+14 -14
View File
@@ -7,22 +7,22 @@ The project aims to provide *high quality* definitions for the most popular libr
Complete
--------
Modernizr
Underscore.js
jQuery (from TypeScript samples)
Node.js (from TypeScript samples)
Express (from TypeScript samples)
* Backbone.js
* Bootstrap
* Express (from TypeScript samples)
* jQuery (from TypeScript samples)
* Modernizr
* Node.js (from TypeScript samples)
* Underscore.js
In Progress
-----------
Backbone.js
Knockout.js
jQuery UI
Bootstrap
* Knockout.js
* jQuery UI
* jQuery Mobile
Soon
Next
----
Angular.js
jQuery.Validate
jQuery Mobile
Globalize
* Angular.js
* jQuery.Validate
* Globalize
+40
View File
@@ -0,0 +1,40 @@
/// <reference path="../Definitions/jquery.d.ts" />
/// <reference path="../Definitions/bootstrap.d.ts" />
$('body').off('.data-api');
$('body').off('.alert.data-api');
$(".btn.danger").button("toggle").addClass("fat");
$("#myModal").modal();
$("#myModal").modal({ keyboard: false });
$("#myModal").modal('show');
$('#myModal').on('show', (e) => e.preventDefault());
$('#myModal').modal({ keyboard: false });
$('#myModal').modal('toggle');
$('.dropdown-toggle').dropdown();
$('#navbar').scrollspy();
$('#element').tooltip('show');
$('#element').popover('show');
$(".alert").alert();
$(".alert").alert('close');
$('.nav-tabs').button();
$().button('toggle');
$(".collapse").collapse();
$('#myCollapsible').collapse({ toggle: false });
$('.carousel').carousel();
$('.carousel').carousel({ interval: 2000 });
$('.typeahead').typeahead();
$('#navbar').affix();