Skip to content

Commit

Permalink
Merge branch 'master' into patch-2
Browse files Browse the repository at this point in the history
Conflicts:
	angularfire/angularfire.d.ts
  • Loading branch information
frankbille committed May 27, 2015
2 parents f35df7a + 36a4540 commit 2f1ba9a
Show file tree
Hide file tree
Showing 10 changed files with 5,207 additions and 12 deletions.
4 changes: 4 additions & 0 deletions angular-file-upload/angular-file-upload-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ module controllers {
},
file: file
})
.abort()
.xhr((evt: any) => {
console.log('xhr');
})
.progress((evt: angular.angularFileUpload.IFileProgressEvent) => {
var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10);
console.log("upload progress: " + percent + "% for " + evt.config.file.name);
Expand Down
3 changes: 2 additions & 1 deletion angular-file-upload/angular-file-upload.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ declare module angular.angularFileUpload {
}

interface IUploadPromise<T> extends IHttpPromise<T> {

abort(): IUploadPromise<T>;
progress(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
xhr(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
}

interface IFileUploadConfig extends IRequestConfig {
Expand Down
8 changes: 4 additions & 4 deletions angularfire/angularfire-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi

// AngularFireObject
{
var obj = sync.$asObject();
var obj = $FirebaseObject(ref);

// $id
if (obj.$id !== ref.name()) throw "error";
Expand All @@ -63,7 +63,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
});

// $ref()
if (obj.$ref() !== sync) throw "error";
if (obj.$ref() !== ref) throw "error";

// $bindTo()
obj.$bindTo($scope, "data").then(function () {
Expand Down Expand Up @@ -92,10 +92,10 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi

// AngularFireArray
{
var list = sync.$asArray();
var list = $FirebaseArray(ref);

// $ref()
if (list.$ref() !== sync) throw "error";
if (list.$ref() !== ref) throw "error";

// $add()
list.$add({ foo: "foo value" });
Expand Down
4 changes: 2 additions & 2 deletions angularfire/angularfire.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ interface AngularFireObject extends AngularFireSimpleObject {
/**
* @returns {Firebase} the original Firebase instance used to create this object.
*/
$ref(): AngularFire;
$ref(): Firebase;

/**
* Creates a 3-way data sync between this object, the Firebase server, and a
Expand Down Expand Up @@ -277,7 +277,7 @@ interface AngularFireArray extends Array<AngularFireSimpleObject> {
/**
* @returns {Firebase} the original Firebase ref used to create this object.
*/
$ref(): AngularFire;
$ref(): Firebase;

/**
* Listeners passed into this method are notified whenever a new change (add, updated,
Expand Down
100 changes: 100 additions & 0 deletions farbtastic/farbtastic-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/// <reference path="farbtastic.d.ts" />

var callback = () => {};
var domNode = document.createElement("div");

// Basic usage

// Can add a ready() handler to the document which initializes the color picker and links it to the text field
$(document).ready(function() {
$("#colorpicker").farbtastic("#color");
});

// Advanced Usage: jQuery Method

// Create color pickers in the selected objects
$("#colorpicker").farbtastic();

// Optional callback using a callback function
$("#colorpicker").farbtastic(callback);
$("#colourpicker").farbtastic(function (color) {
console.log(typeof color === "string");
});

// Optional callback using a DOM node
$("#colorpicker").farbtastic(domNode);

// Optional callback using a jQuery object
$("#colorpicker").farbtastic($("#color"));

// Optional callback using a jQuery selector
$("#colorpicker").farbtastic("#color");

// Advanced Usage: Object

// Can invoke method for returning Farbtastic object instead of a jQuery object
$.farbtastic(domNode);
$.farbtastic($("#color"));
$.farbtastic("#color");

// Optional callback using a callback function
$.farbtastic(domNode, callback);
$.farbtastic($("#color"), callback);
$.farbtastic("#color", callback);

// Optional callback using a DOM node
$.farbtastic(domNode, domNode);
$.farbtastic($("#color"), domNode);
$.farbtastic("#color", domNode);

// Optional callback using a jQuery object
$.farbtastic(domNode, $("#color"));
$.farbtastic($("#color"), $("#color"));
$.farbtastic("#color", $("#color"));

// Optional callback using a jQuery selector
$.farbtastic(domNode, "#color");
$.farbtastic($("#color"), "#color");
$.farbtastic("#color", "#color");

// Advanced Usage: Options
$("#colorpicker").farbtastic({
callback: (color) => {
console.log(color);
}
});
$.farbtastic(domNode, {
width: 500
});
$.farbtastic($("#color"), {
wheelWidth: 300
});
$.farbtastic("#color", {});

// Advanced Usage: Methods
$.farbtastic("#colorpicker").linkTo(callback);
$.farbtastic("#colorpicker").linkTo(domNode);
$.farbtastic("#colorpicker").linkTo("#color");
$.farbtastic("#colorpicker").linkTo($("#color"));

$.farbtastic("#colorpicker").setColor("#aabbcc");
$.farbtastic("#colorpicker").setColor([0.1, 0.2, 0.3]);
$.farbtastic("#colorpicker").setHSL([0.1, 0.2, 0.3]);

// Advanced Usage: Properties
$.farbtastic("#colorpicker").color === "#aabbcc";
$.farbtastic("#colorpicker").hsl === [0.1, 0.2, 0.3];
$.farbtastic("#colorpicker").linked === $("#colorpicker");
$.farbtastic("#colorpicker").linked === callback;

// Can chain jQuery methods
$("#colorpicker")
.farbtastic()
.addClass("color-picker");

// Can chain Farbtastic methods
$.farbtastic("#colorpicker")
.linkTo(domNode)
.setColor("#000000")
.setHSL([0, 0, 0]);

40 changes: 40 additions & 0 deletions farbtastic/farbtastic.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Type definitions for Farbtastic: jQuery Color Wheel v2.0.0-alpha.1
// Project: http://mattfarina.github.io/farbtastic/
// Definitions by: Matt Brooks <https://github.com/EnableSoftware>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../jquery/jquery.d.ts" />

declare module JQueryFarbtastic {
type Placeholder = string | Element | JQuery;
type CallbackFunction = (color: string) => any;
type Callback = CallbackFunction | Placeholder;

interface Options {
callback?: Callback;
width?: number;
wheelWidth?: number;
}

interface Farbtastic {
linked: CallbackFunction | JQuery;
color: string;
hsl: number[];

linkTo(callback: Callback): Farbtastic;
setColor(color: string | number[]): Farbtastic;
setHSL(hsl: number[]): Farbtastic;
}
}

interface JQueryStatic {
farbtastic(placeholder: JQueryFarbtastic.Placeholder, callback: JQueryFarbtastic.Callback): JQueryFarbtastic.Farbtastic;
farbtastic(placeholder: JQueryFarbtastic.Placeholder, options: JQueryFarbtastic.Options): JQueryFarbtastic.Farbtastic;
farbtastic(placeholder: JQueryFarbtastic.Placeholder): JQueryFarbtastic.Farbtastic;
}

interface JQuery {
farbtastic(callback: JQueryFarbtastic.Callback): JQuery;
farbtastic(options: JQueryFarbtastic.Options): JQuery;
farbtastic(): JQuery;
}
4 changes: 4 additions & 0 deletions jquery.placeholder/jquery.placeholder-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
/// <reference path="jquery.placeholder.d.ts"/>

$('input').placeholder();

// specify custom class
$('input').placeholder({ customClass: 'my-placeholder' });

9 changes: 4 additions & 5 deletions jquery.placeholder/jquery.placeholder.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Type definitions for jquery.placeholder.js 2.0.7
// Type definitions for jquery.placeholder.js 2.1.1
// Project: https://github.com/mathiasbynens/jquery-placeholder
// Definitions by: Peter Gill <https://github.com/majorsilence>
// Definitions by: Peter Gill <https://github.com/majorsilence>, Neil Culver <https://github.com/EnableSoftware>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../jquery/jquery.d.ts"/>

interface JQuery {

placeholder() : void;

placeholder(options: { customClass: string }) : JQuery
placeholder() : JQuery
}

Loading

0 comments on commit 2f1ba9a

Please sign in to comment.