forked from Foliotek/Croppie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ádám Rocska
committed
Feb 22, 2016
1 parent
5bb1c11
commit 503f5e5
Showing
9 changed files
with
116 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
npm-debug.log | ||
node_modules/ | ||
bower_components | ||
npm-debug.log | ||
node_modules/ | ||
bower_components | ||
/nbproject/private/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var assert, Croppie; | ||
|
||
assert = require('assert'); | ||
|
||
require('./stubs/window'); | ||
Croppie = require('../../croppie'); | ||
|
||
describe('Croppie', function () { | ||
var testCroppieObject, stubElement; | ||
|
||
beforeEach(function () { | ||
stubElement = new HTMLElement(); | ||
testCroppieObject = new Croppie(stubElement); | ||
}); | ||
|
||
describe('constructor', function () { | ||
it('should expose a reference to its bound element.', function () { | ||
assert.strictEqual(testCroppieObject.element, stubElement); | ||
}); | ||
|
||
it('should use croppy defaults if no options are provided.', function () { | ||
function matchDefaults(actualOptionGroup, expectedOptionGroup, path) { | ||
path = path || 'options'; | ||
|
||
Object | ||
.keys(expectedOptionGroup) | ||
.forEach(function (optionName) { | ||
var currentPath; | ||
|
||
currentPath = [ | ||
path, | ||
optionName | ||
].join('.'); | ||
|
||
if (typeof expectedOptionGroup[optionName] === 'object') { | ||
matchDefaults(actualOptionGroup[optionName], expectedOptionGroup[optionName], currentPath); | ||
} else { | ||
assert.equal(actualOptionGroup[optionName], expectedOptionGroup[optionName], 'Matching ' + currentPath); | ||
} | ||
}); | ||
} | ||
|
||
matchDefaults(testCroppieObject.options, Croppie.defaults); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--reporter spec | ||
--recursive | ||
--growl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
DOMTokenList = function DOMTokenList() { | ||
this.add = function () { | ||
}; | ||
this.remove = function () { | ||
}; | ||
this.item = function () { | ||
}; | ||
this.toggle = function () { | ||
}; | ||
this.contains = function () { | ||
}; | ||
}; | ||
|
||
module.exports = DOMTokenList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
EventTarget = function EventTarget() { | ||
this.addEventListener = function () { | ||
}; | ||
this.removeEventListener = function () { | ||
}; | ||
this.dispatchEvent = function () { | ||
}; | ||
}; | ||
|
||
module.exports = EventTarget; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DOMTokenList = require('./DOMTokenList'); | ||
EventTarget = require('./EventTarget'); | ||
|
||
HTMLElement = function HTMLElement() { | ||
EventTarget.apply(this, arguments); | ||
this.style = {}; | ||
this.classList = new DOMTokenList(); | ||
this.appendChild = function () { | ||
}; | ||
}; | ||
HTMLElement.prototype = Object.create(EventTarget.prototype); | ||
|
||
module.exports = HTMLElement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var HTMLElement; | ||
|
||
HTMLElement = require('./HTMLElement'); | ||
|
||
document = { | ||
createElement : function () { | ||
return new HTMLElement(); | ||
} | ||
}; | ||
|
||
module.exports = document; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var document; | ||
|
||
document = require('./document'); | ||
|
||
window = { | ||
document : document | ||
}; | ||
|
||
module.exports = window; |