Source code

Revision control

Copy as Markdown

Other Tools

{
"name": "jasmine-flight",
"version": "1.1.0",
"description": "Extensions to the Jasmine test framework for use with Flight",
"main": "lib/jasmine-flight.js",
"keywords": [
"flight",
"jasmine",
"test"
],
"ignore": [
".*",
"test",
"package.json",
"karma.conf.js",
"CONTRIBUTING.md",
"CHANGELOG.md"
],
"devDependencies": {
"flight": "~1.0.9"
},
"gitHead": "5174302b9a87ebdda99de6a436ec2a64200fc5ff",
"readme": "# jasmine-flight [![Build Status](https://travis-ci.org/flightjs/jasmine-flight.png?branch=master)](http://travis-ci.org/flightjs/jasmine-flight)\n\nExtensions to the Jasmine test framework for use with [Flight](https://github.com/flightjs/flight)\n\n# Getting started\n\nInclude [jasmine-flight.js](https://raw.github.com/flightjs/jasmine-flight/master/lib/jasmine-flight.js)\nin your app and load it in your test runner.\n\nOr install it with [Bower](http://bower.io/):\n\n```bash\nbower install --save-dev jasmine-flight\n```\n\n**N.B.** jasmine-flight depends on\n[jasmine](https://github.com/pivotal/jasmine) and\n[jasmine-jquery](https://github.com/velesin/jasmine-jquery)\n\n## Components\n\n```javascript\ndescribeComponent('path/to/component', function () {\n beforeEach(function () {\n setupComponent();\n });\n\n it('should do x', function () {\n // a component instance is now accessible as this.component\n // the component root node is attached to the DOM\n // the component root node is also available as this.$node\n });\n});\n```\n\n## Mixins\n\n```javascript\ndescribeMixin('path/to/mixin', function () {\n // initialize the component and attach it to the DOM\n beforeEach(function () {\n setupComponent();\n });\n\n it('should do x', function () {\n expect(this.component.doSomething()).toBe(expected);\n });\n});\n```\n\n## Event spy\n\n```javascript\ndescribeComponent('data/twitter_profile', function () {\n beforeEach(function () {\n setupComponent();\n });\n\n describe('listens for uiNeedsTwitterUserId', function () {\n // was the event triggered?\n it('and triggers dataTwitterUserId', function () {\n var eventSpy = spyOnEvent(document, 'dataTwitterProfile');\n $(document).trigger('uiNeedsTwitterUserId', {\n screen_name: 'tbrd'\n });\n expect(eventSpy).toHaveBeenTriggeredOn(document);\n });\n\n // is the user id correct?\n it('and has correct id', function () {\n var eventSpy = spyOnEvent(document, 'dataTwitterUserId');\n $(document).trigger('uiNeedsTwitteruserId', {\n screen_name: 'tbrd'\n });\n expect(eventSpy.mostRecentCall.data).toEqual({\n screen_name: 'tbrd',\n id: 4149861\n });\n });\n });\n});\n```\n\n## setupComponent\n\n```javascript\nsetupComponent(optionalFixture, optionalOptions);\n```\n\nCalling `setupComponent` twice will create an instance, tear it down and create a new one.\n\n### HTML Fixtures\n\n```javascript\ndescribeComponent('ui/twitter_profile', function () {\n // is the component attached to the fixture?\n it('this.component.$node has class \"foo\"', function () {\n setupComponent('<span class=\"foo\">Test</span>');\n expect(this.component.$node).toHaveClass('foo');\n });\n});\n```\n\n### Component Options\n\n```javascript\ndescribeComponent('data/twitter_profile', function () {\n // is the option set correctly?\n it('this.component.attr.baseUrl is set', function () {\n setupComponent({\n baseUrl: 'http://twitter.com/1.1/'\n });\n expect(this.component.attr.baseUrl).toBe('http://twitter.com/1.1/');\n });\n});\n```\n\n# Teardown\n\nComponents are automatically torn down after each test.\n\n## Contributing to this project\n\nAnyone and everyone is welcome to contribute. Please take a moment to\nreview the [guidelines for contributing](CONTRIBUTING.md).\n\n* [Bug reports](CONTRIBUTING.md#bugs)\n* [Feature requests](CONTRIBUTING.md#features)\n* [Pull requests](CONTRIBUTING.md#pull-requests)\n\n## Authors\n\n* [@tbrd](http://github.com/tbrd)\n\n## Thanks\n\n* [@esbie](http://github.com/esbie) and\n [@skilldrick](http://github.com/skilldrick) for creating the original\n `describeComponent` & `describeMixin` methods.\n\n## License\n\nCopyright 2013 Twitter, Inc and other contributors.\n\nLicensed under the MIT License\n",
"readmeFilename": "README.md",
"_id": "jasmine-flight@1.1.0",
"repository": {
"type": "git",
}
}