Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
702f9fb0
Commit
702f9fb0
authored
Aug 05, 2021
by
Nathan Friend
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use setCookie/getCookie helpers
parent
e0484503
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
app/assets/javascripts/environments/components/environments_app.vue
.../javascripts/environments/components/environments_app.vue
+3
-3
spec/frontend/environments/environments_app_spec.js
spec/frontend/environments/environments_app_spec.js
+4
-4
No files found.
app/assets/javascripts/environments/components/environments_app.vue
View file @
702f9fb0
<
script
>
import
{
GlBadge
,
GlButton
,
GlModalDirective
,
GlTab
,
GlTabs
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
Cookies
from
'
js-cookie
'
;
import
createFlash
from
'
~/flash
'
;
import
{
setCookie
,
getCookie
}
from
'
~/lib/utils/common_utils
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
}
from
'
../constants
'
;
import
eventHub
from
'
../event_hub
'
;
...
...
@@ -68,7 +68,7 @@ export default {
data
()
{
return
{
environmentsSurveyAlertDismissed
:
Cookies
.
get
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
)
===
'
true
'
,
getCookie
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
)
===
'
true
'
,
};
},
...
...
@@ -122,7 +122,7 @@ export default {
},
onSurveyAlertDismiss
()
{
Cookies
.
set
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
,
'
true
'
,
{
expires
:
365
*
10
}
);
setCookie
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
,
'
true
'
);
this
.
environmentsSurveyAlertDismissed
=
true
;
},
},
...
...
spec/frontend/environments/environments_app_spec.js
View file @
702f9fb0
import
{
GlTabs
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
mount
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
MockAdapter
from
'
axios-mock-adapter
'
;
import
Cookies
from
'
js-cookie
'
;
import
{
extendedWrapper
}
from
'
helpers/vue_test_utils_helper
'
;
import
Container
from
'
~/environments/components/container.vue
'
;
import
DeployBoard
from
'
~/environments/components/deploy_board.vue
'
;
...
...
@@ -10,6 +9,7 @@ import EnableReviewAppModal from '~/environments/components/enable_review_app_mo
import
EnvironmentsApp
from
'
~/environments/components/environments_app.vue
'
;
import
{
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
}
from
'
~/environments/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
setCookie
,
getCookie
,
removeCookie
}
from
'
~/lib/utils/common_utils
'
;
import
*
as
urlUtils
from
'
~/lib/utils/url_utility
'
;
import
{
environment
,
folder
}
from
'
./mock_data
'
;
...
...
@@ -291,7 +291,7 @@ describe('Environment', () => {
});
afterEach
(()
=>
{
Cookies
.
remov
e
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
);
removeCooki
e
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
);
});
describe
(
'
when the user has not dismissed the alert
'
,
()
=>
{
...
...
@@ -309,7 +309,7 @@ describe('Environment', () => {
});
it
(
'
persists the dismisal using a cookie
'
,
()
=>
{
const
cookieValue
=
Cookies
.
get
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
);
const
cookieValue
=
getCookie
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
);
expect
(
cookieValue
).
toBe
(
'
true
'
);
});
...
...
@@ -318,7 +318,7 @@ describe('Environment', () => {
describe
(
'
when the user has previously dismissed the alert
'
,
()
=>
{
beforeEach
(
async
()
=>
{
Cookies
.
set
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
,
'
true
'
,
{
expires
:
365
*
10
}
);
setCookie
(
ENVIRONMENTS_SURVEY_DISMISSED_COOKIE_NAME
,
'
true
'
);
await
createWrapper
(
true
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment