From 7d8e08c9b53ecba5e8988ea5cd386d0eadd322df Mon Sep 17 00:00:00 2001 From: "chocolatechipui@sourcebits.com" Date: Fri, 21 Aug 2015 15:42:09 -0700 Subject: [PATCH] Updated types for ChocolateChipJS to 4.0.3. Updated types to match refactored versions of "prop" and "removeProp". --- chocolatechipjs/chocolatechipjs-tests.ts | 6 ++++-- chocolatechipjs/chocolatechipjs.d.ts | 25 +++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/chocolatechipjs/chocolatechipjs-tests.ts b/chocolatechipjs/chocolatechipjs-tests.ts index 06b5817691..111e69f638 100644 --- a/chocolatechipjs/chocolatechipjs-tests.ts +++ b/chocolatechipjs/chocolatechipjs-tests.ts @@ -102,12 +102,14 @@ $('ul').insert("
  • 1
  • 2
  • 3
  • ", 3); $('ul').insert("
  • 1
  • 2
  • 3
  • "); $('ul').html('
  • 1
  • <2/li>
  • 3
  • '); $('ul').html(''); +var listContent = $('ul').html(); $('ul').prepend('
  • The title
  • '); $('ul').append('
  • The Last Item
  • '); var inputName = $('input').attr('name'); $('input').attr('name', 'wobba'); -var inputName = $('input').prop('name'); -$('input').prop('name', 'wobba'); +var inputProperty = $('input').prop('disabled'); +$('input[type=checked]').prop('checked', true); +$('input').removeProp('disabled'); $('input').hasAttr('disabled').css('border', 'solid 1px red'); $('input').removeAttr('disabled'); $('article').hasClass('current').css('display', 'block'); diff --git a/chocolatechipjs/chocolatechipjs.d.ts b/chocolatechipjs/chocolatechipjs.d.ts index 3c84558afe..6a45863b09 100644 --- a/chocolatechipjs/chocolatechipjs.d.ts +++ b/chocolatechipjs/chocolatechipjs.d.ts @@ -1,4 +1,4 @@ -// Type definitions for chocolatechip v4.0.2 +// Type definitions for chocolatechip v4.0.3 // Project: https://github.com/chocolatechipui/ChocolateChipJS // Definitions by: Robert Biggs // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -176,7 +176,8 @@ interface ChocolateChipStatic { * @param response The response from a Promise. * @result */ - json(reponse: Response): JSON; + json(reponse: Response): JSON; + /** * This method will defer the execution of a function until the call stack is clear. * @@ -198,7 +199,7 @@ interface ChocolateChipStatic { * This method makes sure a method always returns an array. If no values are available to return, it returns and empty array. This is to make sure that methods that expect a chainable array will not throw and exception. * * @param result The result of a method to test if it can be returned in an array. - * @return An array hold the results of a method, otherwise an empty array. + * @return An array holding the results of a method, otherwise an empty array. */ returnResult(result: HTMLElement[]): any[]; @@ -836,12 +837,12 @@ interface ChocolateChipElementArray extends Array { hasAttr(attributeName: string): ChocolateChipElementArray; /** - * Get the value of an attribute for the first element in the set of matched elements. + * Test whether an attribute exists on the first element in the set of matched elements. The value returned is a boolean. * * @param attributeName The name of the attribute to get. - * @return string + * @return boolean */ - prop(attributeName: string): string; + prop(propertyName: string): boolean; /** * Set an property for the set of matched elements. @@ -850,7 +851,15 @@ interface ChocolateChipElementArray extends Array { * @param value A string indicating the value to set the property to. * @return HTMLElement[] */ - prop(propertyName: string, value: string): ChocolateChipElementArray; + prop(propertyName: string, value: any | boolean): ChocolateChipElementArray; + + /** + * Remove an element property. + * + * @param property The property to remove. + * @return HTMLElement[] + */ + removeProp(property: string): ChocolateChipElementArray; /** * Adds the specified class(es) to each of the set of matched elements. @@ -1471,5 +1480,3 @@ interface Window { } declare var $: ChocolateChipStatic; declare var fetch: fetch; - -declare var chocolatechipjs: ChocolateChipStatic; \ No newline at end of file