aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngMock
AgeCommit message (Collapse)Author
2013-11-26chore(mocks): wrap angular-mocks.js in closureDavid Mosher
Closes #5080
2013-11-21fix(ngMock): fixes httpBackend expectation with body objectCorey Burrows
Fixes an issue with httpBackend expectations where a given body object may not match the actual request body if its keys are serialized in a different order. Closes #4956
2013-11-14chore(mocks): Remove reference to flushNextJames deBoer
Closes #4885
2013-11-06fix(ngMock): throw more descriptive errors for $animate.flushNext()Jeff Cross
2013-10-28fix(angular-mocks): add inline dependency annotationDerek Hammer
Annotation allows the angular-mocks to be minified, which sometimes happens with frameworks that automatically process files before running tests. Also, some developers have been using this library in code for their applications. This is not recommended as the library is only designed to support testing and not production applications. If you are likely to want to use the code here in production you would be best forking and maintaining your own version of the code as we will not guarantee that we won't break the annotation of the code in the future. Closes #4448
2013-10-23chore(ngMocks): shorten the length of the description line to avoid jsHint ↵Matias Niemelä
errors
2013-10-23feat(docs): provide index pages for each angular moduleMatias Niemelä
2013-10-22style: make jshint happyVojta Jina
2013-10-22chore(grunt): add jshint tasksPete Bacon Darwin
2013-10-18docs: correct broken linksVojta Jina
This also contains some whitespace corrections by my editor.
2013-10-10fix(modules): stop leaking global variables in testsPete Bacon Darwin
The routeUtils.js file was declaring a number of functions that were leaking into other modules such as ngMocks causing tests to pass incorrectly. Closes #4360
2013-10-09fix(ngMock.$interval): should use angular.isDefinedMark J. Titorenko
The newly introduced `$interval` mock service for ngMock calls `isDefined` in the global namespace which fails when used within unit tests. This change adds the missing `angular.` prefix to such `isDefined` calls. Closes #4334 Closes #4353
2013-10-07feat($interval): add a service wrapping setIntervalJulie
The $interval service simplifies creating and testing recurring tasks. This service does not increment $browser's outstanding request count, which means that scenario tests and Protractor tests will not timeout when a site uses a polling function registered by $interval. Provides a workaround for #2402. For unit tests, repeated tasks can be controlled using ngMock$interval's tick(), tickNext(), and tickAll() functions.
2013-10-07fix(*): protect calls to hasOwnProperty in public APIPeter Bacon Darwin
Objects received from outside AngularJS may have had their `hasOwnProperty` method overridden with something else. In cases where we can do this without incurring a performance penalty we call directly on Object.prototype.hasOwnProperty to ensure that we use the correct method. Also, we have some internal hash objects, where the keys for the map are provided from outside AngularJS. In such cases we either prevent `hasOwnProperty` from being used as a key or provide some other way of preventing our objects from having their `hasOwnProperty` overridden. BREAKING CHANGE: Inputs with name equal to "hasOwnProperty" are not allowed inside form or ngForm directives. Before, inputs whose name was "hasOwnProperty" were quietly ignored and not added to the scope. Now a badname exception is thrown. Using "hasOwnProperty" for an input name would be very unusual and bad practice. Either do not include such an input in a `form` or `ngForm` directive or change the name of the input. Closes #3331
2013-10-02feat(ngMock.$timeout): remove flushNext methodVojta Jina
2013-09-28docs(mocks): fix syntax error in exampleRob Culliton
Closes #4183
2013-09-09docs(mock.inject): fix typoPete Bacon Darwin
2013-09-05docs(mock.inject): document underscore wrapping syntaxJasonM23
Add a summary describing the ignored underscore syntax sugar helper, with a simple use case example. Closes #3621
2013-09-03feat(ngMock): allow passing an object literal as shorthand to moduleMerrick Christensen
2013-08-29fix(ngMocks): $logProvider should not use internal APIsAdam de Baugh
angular.mocks.$LogProvider $logProvider.debugEnabled(false) is crashing with undefined when run inside karma/jasmine test runner: angular.module('foo', []).config(['$logProvider', function ($logProvider) { $logProvider.debugEnabled(false); }]); Closes #3612
2013-08-27revert: feat(mocks): make $timeout#flush throw an exception when emptyIgor Minar
This reverts commit cbf06a5d64aba537f0e2679a194d3998d8365493. This turned out to be a bad idea because it allow us to fast-forward the wall clock time (see previous commit).
2013-08-27revert: fix(mocks): $timeout#flush should not update time when emptyIgor Minar
This reverts commit 42af8eada2803a54a98b4f792e60feb480d68a0c. This turned out to be a bad idea as it prevents us from moving the time forward and asserting that the component state didn't change due to the scheduled task executing too early.
2013-08-25fix(mocks): $timeout#flush should not update time when emptyIgor Minar
When $timeout#flush is called with a delay and no task can be flushed within that delay, the current time should not be updated as that gets the mock into an inconsistent state. BREAKING CHANGE: if a tests was written around the buggy behavior the delays might be off now This would typically not be a problem, but because of the previous breaking change in $timeout.flush, the combination of two might be confusing and that's why we are documenting it. Old behavior: ``` doSomething(); //schedules task to execute in 500ms from now doOtherStuff(); //schedules task to execute in 600ms from now try { $timeout.flush(300); // throws "no task to be flushed" exception } catch(e) {}; $time.flush(200); //flushes only doSomething() task ``` New behavior: ``` doSomething(); //schedules task to execute in 500ms from now doOtherStuff(); //schedules task to execute in 600ms from now try { $timeout.flush(300); // throws "no task to be flushed" exception } catch(e) {}; $time.flush(200); // throws "no task to be flushed" exception again // because previous exception didn't move the time forward ``` Fixed test: ``` doSomething(); //schedules task to execute in 500ms from now doOtherStuff(); //schedules task to execute in 600ms from now try { $timeout.flush(300); // throws "no task to be flushed" exception } catch(e) {}; $time.flush(500); // flushes only doSomething() task ```
2013-08-25feat(mocks): make $timeout#flush throw an exception when emptyIgor Minar
When calling $timeout.flush with or without a delay an exception should be thrown if there is nothing to be flushed. This prevents tests from flushing stuff unnecessarily. BREAKING CHANGE: calling $timeout.flush(delay) when there is no task to be flushed within the delay throws an exception now. Please adjust the delay or remove the flush call from your tests as the exception is a signed of a programming error.
2013-08-13chore(mocks): remove obsolte createMockWindow apiIgor Minar
we never released this api, so it's safe to remove
2013-08-09docs(httpBackend): update documentation for expect methodsSanti Albo
`expect` methods can receive an Object as the data parameter, which was undocumented.
2013-08-07chore(dump): fix our karma.dump bridgeIgor Minar
previously it didn't work for dumping multiple objects
2013-08-06feat(ngMock/$httpBackend): support a matching function for data paramKen Chen
Add support for passing function as validating data: - To avoid hacking test method of RegExp - Optionally overwrite `toString` method of fn to show validation tips - change docs: param description for `when`, `whenPost`, `whenPut`, `expect`, `expectPost`, `expectPut`, `expectPATCH` Closes: #2981
2013-08-02chore(ngMock): remove unused $animate delegation methodsMatias Niemelä
2013-08-02chore(ngMock): rename $animate.process to $animate.flushNext()Matias Niemelä
2013-08-01fix(ngMock): keep withCredentials on passThroughÉtienne Barrié
When using passThrough() and specifying withCredentials on the $http call, the option is now passed to the underlying $httpBackend.
2013-07-31fix(mock.$log): keep in sync with $logChirayu Krishnappa
Closes #2343
2013-07-26feat(ngAnimate): complete rewrite of animationsMatias Niemelä
- ngAnimate directive is gone and was replaced with class based animations/transitions - support for triggering animations on css class additions and removals - done callback was added to all animation apis - $animation and $animator where merged into a single $animate service with api: - $animate.enter(element, parent, after, done); - $animate.leave(element, done); - $animate.move(element, parent, after, done); - $animate.addClass(element, className, done); - $animate.removeClass(element, className, done); BREAKING CHANGE: too many things changed, we'll write up a separate doc with migration instructions
2013-07-26feat(ngMock): $timeout.flushNext can expect specific timeout delaysMatias Niemelä
the $timeout mock's flush method allows flushing queued up requests but doesn't allow to for checking with what delay a task was queued up. flushNext flushes the next queued up task and can asserts the scheduled delay.
2013-07-26feat(ngMock): support delay limit for $timeout.flushMatias Niemelä
2013-07-22chore(dump): remove dead codeIgor Minar
This code is not being used any more and the test is now failing due to Karma changes. Karma used to expose window.dump but that changed recently and that's why our build is now failing. I'm removing the code and test, but we still need to figure out how to route window.dump through angular.mock.dump, but that will have to be a separate commit.
2013-07-14style(ngMock): add missing whitespaceDavid
2013-07-10docs(ngMock): correct verifyNoOutstandingExpectation exampleMark Striemer
2013-06-27docs(ngMock/$httpBackend): fix testing examplePete Bacon Darwin
Closes #3075
2013-06-19feat(jqLite): switch bind/unbind to more recent jQuery on/offMichał Gołębiowski
jQuery switched to a completely new event binding implementation as of 1.7.0, centering around on/off methods instead of previous bind/unbind. This patch makes jqLite match this implementation while still supporting previous bind/unbind methods.
2013-06-17fix(ngMock): ensure mocked window still provides window.location functionalityMatias Niemelä
2013-06-04docs(angular-mocks): fix typo in exampleRobb Shecter
fromJSON() should be fromJson()
2013-05-24feat(ngError): add error message compression and better error messagesIgor Minar
- add toThrowNg matcher
2013-05-20feat($http): add support for aborting via timeout promisesDavid Bennett
If the timeout argument is a promise, abort the request when it is resolved. Implemented by adding support to $httpBackend service and $httpBackend mock service. This api can also be used to explicitly abort requests while keeping the communication between the deffered and promise unidirectional. Closes #1159
2013-05-18docs(ngMock::$log): improve the `$log.*.logs` descriptionsChris M
Because ngDoc generation only takes the last segment of a property name, each $log.[error|warn|log...].logs property has the same name and is confusing in the docs. This commit helps this by adding a link to the $log.* method and also an appropriate usage example.
2013-04-11docs: fix typosMatt Haggard
2013-04-11fix(ngAnimate): skip animation on first renderMatias Niemelä
2013-04-11docs(angular-mocks): fix wordingBrent Morrow
2013-04-02feat(ngAnimate): add support for animationMisko Hevery
2013-03-29docs(mocks): fix typosGert Goet