Merge pull request #3572 from cyrilschumacher/master

Add definition for "acc-wizard", "IBAN.js" and "jquery.dropotron"
This commit is contained in:
Masahiro Wakame
2015-02-03 12:01:34 +09:00
9 changed files with 455 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="acc-wizard.d.ts" />
/**
* @summary Test for "accwizard" without options.
*/
function testBasic() {
$('#test').accwizard();
}
/**
* @summary Test for "accwizard" with options.
*/
function testWithOptions() {
var options: AccWizardOptions = {
addButtons: true,
sidebar: '.acc-wizard-sidebar',
activeClass: 'acc-wizard-active',
completedClass: 'acc-wizard-completed',
todoClass: 'acc-wizard-todo',
stepClass: 'acc-wizard-step',
nextText: 'Next Step',
backText: 'Go Back',
nextType: 'submit',
backType: 'reset',
nextClasses: 'btn btn-primary',
backClasses: 'btn',
autoScrolling: true,
onNext: function() {},
onBack: function() {},
onInit: function() {},
onDestroy: function() {}
};
$('#test').accwizard(options);
}
+101
View File
@@ -0,0 +1,101 @@
// Type definitions for acc-wizard
// Project: https://github.com/sathomas/acc-wizard
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface AccWizardOptions {
/**
* @summary Add next/prev buttons to panels.
* @type {boolean}
*/
addButtons: boolean;
/**
* @summary Selector for task sidebar.
* @type {string}
*/
sidebar: string;
/**
* @summary Class to indicate the active task in sidebar.
* @type {string}
*/
activeClass: string;
/**
* @summary Class to indicate task is complete.
* @type {string}
*/
completedClass: string;
/**
* @summary Class to indicate task is still pending.
* @type {string}
*/
todoClass: string;
/**
* @summary Class for step buttons within panels.
* @type {string}
*/
stepClass: string;
/**
* @summary Text for next button.
* @type {string}
*/
nextText: string;
/**
* @summary Text for back button
* @type {string}
*/
backType: string;
/**
* @summary Class(es) for next button.
* @type {string}
*/
nextClasses: string;
/**
* @summary Class(es) for back button.
* @type {string}
*/
backClasses: string;
/**
* @summary Auto-scrolling.
* @type {boolean}
*/
autoScrolling: boolean;
/**
* @summary Function to call on next step.
*/
onNext: Function;
/**
* @summary Function to call on back up.
*/
onBack: Function;
/**
* @summary A chance to hook initialization.
*/
onInit: Function;
/**
* @summary A chance to hook destruction.
*/
onDestroy: Function;
}
/**
* @summary Interface for "acc-wizard" JQuery plugin.
* @author Cyril Schumacher
* @version 1.0
*/
interface JQuery {
accwizard(options?: AccWizardOptions): void;
}
+1
View File
@@ -0,0 +1 @@
--noImplicitAny
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="iban.d.ts" />
/**
* @summary Test for "electronicFormat" method.
*/
function testElectronicFormat() {
var iban: string = 'BE68539007547034';
var format: string = IBAN.electronicFormat(iban);
}
/**
* @summary Test for "fromBBAN" method.
*/
function testFromBBAN() {
var countryCode: string = 'fr';
var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK';
var iban: string = IBAN.fromBBAN(countryCode, bban);
}
/**
* @summary Test for "isValid" method.
*/
function testIsValid() {
var iban: string = 'BE68539007547034';
var valid: boolean = IBAN.isValid(iban);
}
/**
* @summary Test for "isValidBBAN" method.
*/
function testIsValidBBAN() {
var countryCode: string = 'fr';
var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK';
var valid: boolean = IBAN.isValidBBAN(countryCode, bban);
}
/**
* @summary Test for "printFormat" method.
*/
function testPrintFormat() {
var iban: string = 'BE68539007547034';
var separator: string[] = ['fr'];
var format: string = IBAN.printFormat(iban, separator);
}
/**
* @summary Test for "toBBAN" method.
*/
function testToBBAN() {
var iban: string = 'BE68539007547034';
var separator: string[] = ['-'];
var bban: string = IBAN.toBBAN(iban, separator);
}
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for iban.js 0.0.5
// Project: https://github.com/arhs/iban.js/
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module ARHS {
/**
* @summary Interface for {@link IBAN} object.
* @author Cyril Schumacher
* @version 1.0
*/
interface IBANStatic {
/**
* @summary Returns the IBAN in a electronic format.
* @param {string} iban The IBAN to convert.
* @param {string} The IBAN in electronic format.
*/
electronicFormat(iban: string): string;
/**
* @summary Convert the passed BBAN to an IBAN for this country specification.
* @param {string} countryCode The country of the BBAN.
* @param {string} bban The BBAN to convert to IBAN.
* @returns {string} The IBAN.
*/
fromBBAN(countryCode: string, bban: string): string;
/**
* @summary Check if the passed iban is valid according to this specification.
* @param {string} iban The iban to validate.
* @returns {boolean} True if valid, false otherwise.
*/
isValid(iban: string): boolean;
/**
* @summary Check of the passed BBAN is valid.
* @param {string} countryCode The country of the BBAN.
* @param {string} bban The BBAN to validate.
* @returns {boolean} True if valid, false otherwise.
*/
isValidBBAN(countryCode: string, bban: string): boolean;
/**
* @summary Returns the IBAN in a print format.
* @param {string} iban The IBAN to convert.
* @param {string} The IBAN in print format.
*/
printFormat(iban: string, separator: string[]): string;
/**
* @summary Convert the passed IBAN to a country-specific BBAN.
* @param {string} iban The IBAN to convert.
* @param {string[]} Separator the separator to use between BBAN blocks.
* @returns {string} The BBAN
*/
toBBAN(iban: string, separator: string[]): string;
}
}
declare var IBAN: ARHS.IBANStatic;
+1
View File
@@ -0,0 +1 @@
--noImplicitAny
@@ -0,0 +1,42 @@
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="jquery.dropotron.d.ts" />
/**
* @summary Test for "dropotron" without configurations.
*/
function testDropotron() {
var foo: JQuery = $('#main-nav > ul');
foo.dropotron();
}
/**
* @summary Test for "dropotron" with configurations.
*/
function testDropotronConfiguration() {
var config: DropotronConfiguration = {
selectorParent: null,
baseZIndex: 1000,
menuClass: 'dropotron',
expandMode: 'hover',
hoverDelay: 150,
hideDelay: 250,
openerClass: 'opener',
openerActiveClass: 'active',
submenuClassPrefix: 'level-',
mode: 'fade',
speed: 'fast',
easing: 'swing',
alignment: 'left',
offsetX: 0,
offsetY: 0,
globalOffsetY: 0,
IEOffsetX: 0,
IEOffsetY: 0,
noOpenerFade: true,
detach: true,
cloneOnDetach: true
};
var foo: JQuery = $('#main-nav > ul');
foo.dropotron(config);
}
+160
View File
@@ -0,0 +1,160 @@
// Type definitions for jquery.dropotron 1.4.3
// Project: https://github.com/n33/jquery.dropotron
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped/
/**
* @summary Interface for "dropotron" configurations.
* @author Cyril Schumacher
* @version 1.0
*/
interface DropotronConfiguration {
/**
* @summary Alignment ("left", "center", "right").
* @type {string}
*/
alignment: string;
/**
* @summary Base Z-Index.
* @type {number}
*/
baseZIndex: number;
/**
* @summary If true and detach = true, leave original menu intact.
* @type {boolean}
*/
cloneOnDetach: boolean;
/**
* @summary Detach second level menus (prevents parent style bleed).
* @type {boolean}
*/
detach: boolean;
/**
* @summary Easing mode ("swing", "linear").
* @type {string}
*/
easing: string;
/**
* @summary IE Offset X.
* @type {number}
*/
IEOffsetX: number;
/**
* @summary IE Offset Y.
* @type {number}
*/
IEOffsetY: number;
/**
* @summary Expansion mode ("hover" or "click").
* @type {string}
*/
expandMode: string;
/**
* @summary Global offset Y.
* @type {number}
*/
globalOffsetY: number;
/**
* @summary Hide delay (in ms; 0 disables).
* @type {number}
*/
hideDelay: number;
/**
* @summary Hover delay (in ms).
* @type {number}
*/
hoverDelay: number;
/**
* @summary Menu class (assigned to every <ul>).
* @type {string}
*/
menuClass: string;
/**
* @summary Menu mode ("instant", "fade", "slide", "zoom").
* @type {string}
*/
mode: string;
/**
* @summary If true and mode = "fade", prevents top-level opener fade.
* @type {boolean}
*/
noOpenerFade: boolean;
/**
* @summary Submenu offset X.
* @type {number}
*/
offsetX: number;
/**
* @summary Submenu offset Y.
* @type {number}
*/
offsetY: number;
/**
* @summary Active opener class.
* @type {string}
*/
openerActiveClass: string;
/**
* @summary Opener class.
* @type {string}
*/
openerClass: string;
/**
* @summary Parent jQuery object.
* @type {JQuery}
*/
selectorParent: JQuery;
/**
* @summary Menu speed ("fast", "slow", or ms).
* @type {string}
*/
speed: string;
/**
* @summary Submenu class prefix.
* @type {string}
*/
submenuClassPrefix: string;
}
/**
* @summary Interface for "dropotron".
* @author Cyril Schumacher
* @version 1.0
*/
interface Dropotron {
/**
* @summary Adds multilevel dropdown menus to jQuery.
* @param {DropotronConfiguration} config Optional. Configuration.
*/
(config?: DropotronConfiguration): void;
}
/**
* @summary Interface for "JQuery".
* @author Cyril Schumacher
* @version 1.0
*/
interface JQuery {
dropotron: Dropotron;
}
@@ -0,0 +1 @@
--noImplicitAny