Comments (7)
Yes, the reason we didn't use it was because at the time we need to call location
(in .config()
) it isn't available. If you know how to make it work, please let us know.
from angular-apimock.
We've changed things since then I remember now. It might be possible, will try it out! Hopefully it will allow unit-testing of that part. Busy creating demos atm.
from angular-apimock.
@seriema Thanks,
I did a refactor of the code and add the unit test for your review.
Also, i'll create an issue #4 to extend the test and check or prepare the work with external data services.
from angular-apimock.
This issue can be the request for a pure $location refactor. If you do just the $location bit with the tests you have it would be awesome. Please sync down the latest code though, just did some big updates.
from angular-apimock.
Two things to think about is routing.
- Query parameters like
apimock=true
don't sit inwindow.location.search
butwindow.location.hash
. Need to verify that this works with $location. - When using
ngRoute
it doesn't do a page refresh when adding?apimock=true
so the parameter isn't picked up. Need to make sure routes update the mock flag. See here for a sample where this breaks.
from angular-apimock.
@seriema about:
- I understood the explanation, but still is difficult see the issue or the new feature that you propourse without a code example.
Could you create a fail spec in the test?
Thanks
- You could try to add reloadOnSearch=false in the route
$routeProvider
.when('/', {
templateUrl: 'views/movies-table-list.html',
controller: 'MoviesCtrl',
reloadOnSearch: false
})
.otherwise({
redirectTo: '/movies/list/'
});
});
Could you give access to the demo code?
All the best...
from angular-apimock.
-
We don't need to worry about that anymore. It seems to be working with $location.
-
Interesting! Two issues with that though. It would require ngRoute (we want to minimize dependencies) and it seems to be set on a per-url-basis (we need something generic).
The demo code is in the gh-pages-dev
branch. Thinking about moving them here to a /docs
folder or something.
from angular-apimock.
Related Issues (20)
- Drop IE8 support HOT 2
- Only `?apimock=true` is working
- Fix and improve publish task
- Raise test coverage
- Support Angular 1.5 HOT 3
- Go through the badges in README.md
- Use Docker in Travis HOT 1
- Inconsistent handling of undefined URL params HOT 1
- Decide on a date format for URL query params HOT 2
- Date in URL's were breaking on IE8
- Add nodesecurity.io to build task
- Publishing task is broken
- Timestamps in filepath are invalid
- npm page looks broken
- Install through NPM error HOT 2
- Testing directives with templateUrl returns blank templates HOT 12
- the ability to return headers in mock requests HOT 8
- Use $httpBackend service in unit tests with apiMock HOT 1
- Add a main entry in package.json HOT 1
- Use original request if the reroute fails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-apimock.