Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
feat(scenario): expose jQuery for usage outside of angular scenario
Browse files Browse the repository at this point in the history
The global jQuery reference is removed by angular scenario and only a local scoped reference is kept. To make jQuery available for other code, a new reference angular.scenario.jQuery is added.
  • Loading branch information
andimarek authored and jeffbcross committed Jul 31, 2013
1 parent ca3e0c8 commit 3fdbe81
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ngScenario/Scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
// Public namespace
angular.scenario = angular.scenario || {};

/**
* Expose jQuery (e.g. for custom dsl extensions).
*/
angular.scenario.jQuery = _jQuery;

/**
* Defines a new output format.
*
Expand Down
12 changes: 12 additions & 0 deletions test/ngScenario/ScenarioSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@ describe("ScenarioSpec: Compilation", function() {
expect(jqLite(element).text()).toEqual('123');
}));
});

describe('jQuery', function () {
it('should exist on the angular.scenario object', function () {
expect(angular.scenario.jQuery).toBeDefined();
});

it('should have common jQuery methods', function () {
var jQuery = angular.scenario.jQuery;
expect(typeof jQuery).toEqual('function');
expect(typeof jQuery('<div></div>').html).toEqual('function');
})
});
});

0 comments on commit 3fdbe81

Please sign in to comment.