alfhen / vue-cookie

A Vue.js plugin for manipulating cookies
MIT License
822 stars 74 forks source link

Set object in Cookie #15

Closed januszhou closed 6 years ago

januszhou commented 7 years ago

Add ability to set object in Cookie and get object by using getJSON

januszhou commented 7 years ago

Hi @alfhen, I think you made the point. I made few updates, the only different compare your sample code is I didn't return boolean if exception happened, so even you call setObject but value is string, it will still pass. Same applies to getObject.

januszhou commented 7 years ago

@alfhen Nice catch, it has been fixed.

Besides that, do you have any idea why circleCI didn't runs my setObject test?

Test result as below.

ok 1 Firefox 47.0 - VueCookie Should set and retrieve a Cookie with given value.
ok 2 Firefox 47.0 - VueCookie Should delete existing cookie and get null when fetching deleted cookie.
ok 3 Firefox 47.0 - VueCookie Should set and retrieve a Cookie with given value from a domain.
ok 4 Firefox 47.0 - VueCookie Should delete existing cookie with a domain and get null when fetching deleted cookie.
ok 5 Chrome 54.0 - VueCookie Should set and retrieve a Cookie with given value.
    ---
        Log: |
            { type: 'log',
              text: '\'Download the Vue Devtools for a better development experience:\\nhttps://github.com/vuejs/vue-devtools\'\n' }
    ...
ok 6 Chrome 54.0 - VueCookie Should delete existing cookie and get null when fetching deleted cookie.
ok 7 Chrome 54.0 - VueCookie Should set and retrieve a Cookie with given value from a domain.
ok 8 Chrome 54.0 - VueCookie Should delete existing cookie with a domain and get null when fetching deleted cookie.
ok 9 PhantomJS 2.1 - VueCookie Should set and retrieve a Cookie with given value.
ok 10 PhantomJS 2.1 - VueCookie Should delete existing cookie and get null when fetching deleted cookie.
ok 11 PhantomJS 2.1 - VueCookie Should set and retrieve a Cookie with given value from a domain.
ok 12 PhantomJS 2.1 - VueCookie Should delete existing cookie with a domain and get null when fetching deleted cookie.
alfhen commented 7 years ago

@januszhou The reason why CircleCi does not run your test is because it has problems compiling the files on the virtual server it runs, therefore whenever you make changes to the tests, you have to run npm run build-test from the root of the project. This will compile the spec file, then you must commit it along with the rest of your changes. I now it is troublesome, but I haven't had the time to fix the compiling on CircleCI. It is my wish to replace it with Webpack at some point when I find the time.

caiyawen commented 7 years ago

Could you tell me when do you attend to merge this request since I need this feature ?