Comments (8)
@geekygrappler: I think you were working on a PR?
from ember-cookies.
Should that be a test helper maybe? Also we could think about not actually writing any cookies in the test
environment at all but only store everything in memory so that tests would leave no traces. That would break cases where external JS libraries would actually require a cookie that'd be written through ember-cookies.
from ember-cookies.
I think a clearAll()
might also be useful outside the context of testing, and making it something different than a simple method on the existing service will increase the complexity of the API quite a bit.
I guess having pluggable adapters as the base for this addon might be an interesting thing to explore given that we already have browser
and fastboot
adapters.
from ember-cookies.
I think a clearAll() might also be useful outside the context of testing
I think this might lead to all kinds of problems potentially as you'd delete all cookies, not just the ones written via ember-cookies (but also ones written by other libraries, set by the server etc.).
and making it something different than a simple method on the existing service will increase the complexity of the API quite a bit.
Hm, wouldn't that just be
import clearAllCookies from 'ember-cookies';
…
clearAllCookies();
I guess having pluggable adapters as the base for this addon might be an interesting thing to explore given that we already have browser and fastboot adapters.
This would make ember-cookies seriously more complex though so let's see whether we see an actual use case for this.
from ember-cookies.
+1 on this. I came to the issues here looking for this exact thing because I'm trying to figure out how to reset cookies in start-app
. Even if there wasn't a clearAll
, it'd be nice to be able to import read
, write
, and clear
as separate functions independent of the service for use in tests.
from ember-cookies.
I've done some investigation. When reading a cookie, we only get the key value pair, and not the path, which means I don't think a clearAll()
method would be able to pass a cookies path.
So if we had a cookie which was test=val
and it was on path /testing
, a read would give us {test: val}
and then if we called clear(test)
it might not be cleared, because we didn't pass the path. If no path is passed the current path is used. e.g. if we were on /testing/some/other/path
then the /testing
cookie wouldn't be deleted, if we were on /testing
it would be.
Is this an acceptable limitation?
from ember-cookies.
I think we should still allow passing options to clearAll
. The purpose of ember-cookies is really just to provide an API for cookie that works in the browser as well as in FastBoot without doing anything else really or adding anything in addition to that abstraction layer. That said, I think if anyone knows all the options for all the cookies they want to clear we shouldn't stand in the way and let them pass them to clearAll
.
from ember-cookies.
I've also faced issues with cookies in acceptance tests. Would be great to have that clearAll
option :)
from ember-cookies.
Related Issues (20)
- Expire On Cookie HOT 1
- DEPRECATION: Use of `merge` has been deprecated HOT 2
- An in-range update of ember-cli-babel is breaking the build 🚨 HOT 3
- Fastboot causes double decoding HOT 2
- Addon causes linked apps to error during build. "Babel loaded v6.x.x" HOT 1
- npm deploy build step failed HOT 2
- `Cannot read property 'split' of undefined` error in tests when upgrading to ember 3.13.0 HOT 1
- [0.5.1 Regression] TypeError: Cannot read property 'isFastBoot' of undefined HOT 1
- Add SameSite=None support (and UA check?) HOT 3
- nodetest task HOT 1
- Setting max age in FastBoot
- Add a timeout to CI GitHub workflow for test step
- cookies not working
- Dependency Dashboard
- Cut new release HOT 3
- Convert addon to V2 HOT 2
- TypeError: can't access dead object HOT 2
- Ember v5 - current ember-canary, ember-beta channels are failing under fastboot HOT 1
- [Embroider] Fails under fastboot in embroider-optimized scenario
- Action Required: Fix Renovate Configuration
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 ember-cookies.