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
bd618ae2
Commit
bd618ae2
authored
Jun 02, 2021
by
Nathan Friend
Committed by
Miguel Rincon
Jun 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary stubbed component
And also fix one more typo in a constant.
parent
450d0ce0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
app/assets/javascripts/releases/components/releases_sort_apollo_client.vue
...ripts/releases/components/releases_sort_apollo_client.vue
+4
-4
spec/frontend/releases/components/releases_sort_apollo_client_spec.js
...d/releases/components/releases_sort_apollo_client_spec.js
+11
-7
No files found.
app/assets/javascripts/releases/components/releases_sort_apollo_client.vue
View file @
bd618ae2
<
script
>
import
{
GlSorting
,
GlSortingItem
}
from
'
@gitlab/ui
'
;
import
{
ASCENDING_ODER
,
ASCENDING_O
R
DER
,
DESCENDING_ORDER
,
SORT_OPTIONS
,
RELEASED_AT
,
...
...
@@ -36,7 +36,7 @@ export default {
},
direction
()
{
if
(
this
.
value
===
RELEASED_AT_ASC
||
this
.
value
===
CREATED_ASC
)
{
return
ASCENDING_ODER
;
return
ASCENDING_O
R
DER
;
}
return
DESCENDING_ORDER
;
...
...
@@ -48,12 +48,12 @@ export default {
return
this
.
sortOptions
.
find
((
s
)
=>
s
.
orderBy
===
this
.
orderBy
).
label
;
},
isDirectionAscending
()
{
return
this
.
direction
===
ASCENDING_ODER
;
return
this
.
direction
===
ASCENDING_O
R
DER
;
},
},
methods
:
{
onDirectionChange
()
{
const
direction
=
this
.
isDirectionAscending
?
DESCENDING_ORDER
:
ASCENDING_ODER
;
const
direction
=
this
.
isDirectionAscending
?
DESCENDING_ORDER
:
ASCENDING_O
R
DER
;
this
.
emitInputEventIfChanged
(
this
.
orderBy
,
direction
);
},
onSortItemClick
(
item
)
{
...
...
spec/frontend/releases/components/releases_sort_apollo_client_spec.js
View file @
bd618ae2
import
{
GlSorting
}
from
'
@gitlab/ui
'
;
import
{
GlSorting
,
GlSortingItem
}
from
'
@gitlab/ui
'
;
import
{
shallowMountExtended
}
from
'
helpers/vue_test_utils_helper
'
;
import
ReleasesSortApolloClient
from
'
~/releases/components/releases_sort_apollo_client.vue
'
;
import
{
RELEASED_AT_ASC
,
RELEASED_AT_DESC
,
CREATED_ASC
,
CREATED_DESC
}
from
'
~/releases/constants
'
;
const
GlSortingItemStub
=
{
template
:
'
<div><slot></slot></div>
'
,
};
describe
(
'
releases_sort_apollo_client.vue
'
,
()
=>
{
let
wrapper
;
...
...
@@ -16,7 +12,7 @@ describe('releases_sort_apollo_client.vue', () => {
value
:
valueProp
,
},
stubs
:
{
GlSortingItem
:
GlSortingItemStub
,
GlSortingItem
,
},
});
};
...
...
@@ -26,7 +22,7 @@ describe('releases_sort_apollo_client.vue', () => {
});
const
findSorting
=
()
=>
wrapper
.
findComponent
(
GlSorting
);
const
findSortingItems
=
()
=>
wrapper
.
findAllComponents
(
GlSortingItem
Stub
);
const
findSortingItems
=
()
=>
wrapper
.
findAllComponents
(
GlSortingItem
);
const
findReleasedDateItem
=
()
=>
findSortingItems
().
wrappers
.
find
((
item
)
=>
item
.
text
()
===
'
Released date
'
);
const
findCreatedDateItem
=
()
=>
...
...
@@ -96,4 +92,12 @@ describe('releases_sort_apollo_client.vue', () => {
expect
(
wrapper
.
emitted
().
input
?.[
0
]?.[
0
]).
toEqual
(
emittedEvent
);
});
});
describe
(
'
prop validation
'
,
()
=>
{
it
(
'
validates that the `value` prop is one of the expected sort strings
'
,
()
=>
{
expect
(()
=>
{
createComponent
(
'
not a valid value
'
);
}).
toThrow
(
'
Invalid prop: custom validator check failed
'
);
});
});
});
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