Skip to content

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
searls committed Feb 15, 2014
1 parent cd1f609 commit 4796206
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jasmine-fixture",
"version": "1.1.0",
"version": "1.2.0",
"main": "dist/jasmine-fixture.js",
"ignore": [
"app",
Expand Down
47 changes: 32 additions & 15 deletions dist/jasmine-fixture.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* jasmine-fixture - 1.1.0
/* jasmine-fixture - 1.2.0
* Makes injecting HTML snippets into the DOM easy & clean!
* https://github.com/searls/jasmine-fixture
*/
Expand All @@ -7,9 +7,10 @@
__slice = [].slice;

(function($) {
var jasmineFixture, originalAffix, originalJasmineFixture, root, _;
var ewwSideEffects, jasmineFixture, originalAffix, originalJasmineDotFixture, originalJasmineFixture, root, _, _ref;
root = this;
originalJasmineFixture = root.jasmineFixture;
originalJasmineDotFixture = (_ref = root.jasmine) != null ? _ref.fixture : void 0;
originalAffix = root.affix;
_ = function(list) {
return {
Expand All @@ -25,8 +26,11 @@
};
};
root.jasmineFixture = function($) {
var $whatsTheRootOf, createNodes;
$.fn.createNodes = createNodes = function(selectorOptions, attach) {
var $whatsTheRootOf, affix, create, jasmineFixture, noConflict;
affix = function(selectorOptions) {
return create.call(this, selectorOptions, true);
};
create = function(selectorOptions, attach) {
var $top;
$top = null;
_(selectorOptions.split(/[ ](?=[^\]]*?(?:\[|$))/)).inject(function($parent, elementSelector) {
Expand All @@ -43,8 +47,15 @@
}, $whatsTheRootOf(this));
return $top;
};
$.fn.affix = root.affix = function(selectorOptions) {
return createNodes.call(this, selectorOptions, true);
noConflict = function() {
var currentJasmineFixture, _ref1;
currentJasmineFixture = jasmine.fixture;
root.jasmineFixture = originalJasmineFixture;
if ((_ref1 = root.jasmine) != null) {
_ref1.fixture = originalJasmineDotFixture;
}
root.affix = originalAffix;
return currentJasmineFixture;
};
$whatsTheRootOf = function(that) {
if (that.jquery != null) {
Expand All @@ -55,17 +66,23 @@
return $('<div id="jasmine_content"></div>').appendTo('body');
}
};
afterEach(function() {
jasmineFixture = {
affix: affix,
create: create,
noConflict: noConflict
};
ewwSideEffects(jasmineFixture);
return jasmineFixture;
};
ewwSideEffects = function(jasmineFixture) {
var _ref1;
if ((_ref1 = root.jasmine) != null) {
_ref1.fixture = jasmineFixture;
}
$.fn.affix = root.affix = jasmineFixture.affix;
return afterEach(function() {
return $('#jasmine_content').remove();
});
$.jasmine = {
noConflict: function() {
root.jasmineFixture = originalJasmineFixture;
root.affix = originalAffix;
return this;
}
};
return $.jasmine;
};
if ($) {
return jasmineFixture = root.jasmineFixture($);
Expand Down
4 changes: 2 additions & 2 deletions dist/jasmine-fixture.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jasmine-fixture",
"description": "Makes injecting HTML snippets into the DOM easy & clean!",
"version": "1.1.0",
"version": "1.2.0",
"keywords": [
"jasmine",
"bdd"
Expand Down

0 comments on commit 4796206

Please sign in to comment.