Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions README
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
Extendables is an MIT-licensed developers' framework for Adobe ExtendScript. It is currently unmaintained and there are no guarantees it will continue to work with the latest versions of the Creative Suite and/or ExtendScript.
This is my fork of http://debrouwere.github.com/Extendables. See the source project for documentation and more info.

Extendables comes with three big blocks of functionality.
The difference with my fork is:

1. Additional methods on built-in objects like String and Array that give you the Javascript 1.8 features you're used to (think `forEach`), conveniences for functional programming (think `map`, `reduce`, `filter`), easy serialization to JSON or base64 and more.
2. Additional methods on InDesign DOM objects that make coding in InDesign less verbose.
3. Packages for logging, unit testing, http, user interface development, and a couple of other goodies.
* have issue tracker to track issues with Extendables framework, since the original source project has no issue tracker currently.

If you're writing heavy-duty automations for a Creative Suite app like InDesign, or anything more than just a throwaway script, this is for you.

Read the documentation at http://debrouwere.github.com/Extendables/docs/ to learn more and get started.
* fix issues and offer enhancements as I get to them. See the issue tracker of open and closed issues for details. Some info might be put on the wiki as well.
25 changes: 25 additions & 0 deletions dependencies/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,31 @@ jasmine.Matchers.prototype.toThrow = function(expected) {
return result;
};

/**
* toBeCloseTo: compares that actual is close to the value of expected, based on given precision value for number of decimal places.
*
* @param expected
* @param precision
*/
jasmine.Matchers.prototype.toBeCloseTo = function() {

function toBeCloseTo() {
return {
compare: function(actual, expected, precision) {
if (precision !== 0) {
precision = precision || 2;
}

return {
pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
};
}
};
}

return toBeCloseTo;
};

jasmine.Matchers.Any = function(expectedClass) {
this.expectedClass = expectedClass;
};
Expand Down
10 changes: 10 additions & 0 deletions test/jasmine.specs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('Jasmine unit tests against Jasmine changes', function () {
it("The 'toBeCloseTo' matcher is for precision math comparison", function() {
var pi = 3.1415926,
e = 2.78;

//expect(pi).not.toBeCloseTo(e, 2);
expect(pi).toBeCloseTo(e, 0);
expect(12.34).toBeCloseTo(12.3, 1); // success
});
});