Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
Manage
Activity
Members
Labels
Plan
Issues
21
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106_2022_02
boco-frontend
Commits
36b5d289
Commit
36b5d289
authored
2 years ago
by
Zara Mudassar
Browse files
Options
Downloads
Patches
Plain Diff
item card related files deleted, now this branch only includes adding new item related files
parent
f5467460
No related branches found
Branches containing commit
No related tags found
2 merge requests
!19
Item card
,
!17
Item card
Pipeline
#176186
passed with stages
in 1 minute and 20 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/AddNewItem.vue
+2
-1
2 additions, 1 deletion
src/components/AddNewItem.vue
src/router/index.js
+0
-5
0 additions, 5 deletions
src/router/index.js
tests/unit/add-new-item.spec.js
+31
-33
31 additions, 33 deletions
tests/unit/add-new-item.spec.js
with
33 additions
and
39 deletions
src/components/AddNewItem.vue
+
2
−
1
View file @
36b5d289
...
...
@@ -10,7 +10,8 @@
<label
class=
"block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
id=
"titleLabel"
>
Tittel
</label>
>
Tittel
</label
>
<input
type=
"text"
id=
"title"
...
...
This diff is collapsed.
Click to expand it.
src/router/index.js
+
0
−
5
View file @
36b5d289
...
...
@@ -27,11 +27,6 @@ const routes = [
name
:
"
addNewItem
"
,
component
:
()
=>
import
(
"
../views/AddNewItemView.vue
"
),
},
{
path
:
"
/itemCard
"
,
name
:
"
itemCard
"
,
component
:
()
=>
import
(
"
../views/ItemCardView.vue
"
),
},
];
const
router
=
createRouter
({
...
...
This diff is collapsed.
Click to expand it.
tests/unit/add-new-item.spec.js
+
31
−
33
View file @
36b5d289
...
...
@@ -2,37 +2,35 @@ import { shallowMount } from "@vue/test-utils";
import
AddNewItem
from
"
@/components/AddNewItem.vue
"
;
describe
(
"
addNewItem elements rendering
"
,
()
=>
{
it
(
"
renders all labels
"
,
()
=>
{
const
wrapper
=
shallowMount
(
AddNewItem
);
expect
(
wrapper
.
find
(
'
#titleLabel
'
).
text
()).
toMatch
(
"
Tittel
"
);
expect
(
wrapper
.
find
(
'
#selectCategoryLabel
'
).
text
()).
toMatch
(
"
Kategori
"
);
expect
(
wrapper
.
find
(
'
#priceLabel
'
).
text
()).
toMatch
(
"
Pris
"
);
expect
(
wrapper
.
find
(
'
#descriptionLabel
'
).
text
()).
toMatch
(
"
Beskrivelse
"
);
expect
(
wrapper
.
find
(
'
#imageLabel
'
).
text
()).
toMatch
(
"
Bilde
"
);
});
it
(
"
Tests setting values of input field
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
AddNewItem
);
const
titleInput
=
wrapper
.
find
(
'
#title
'
);
await
titleInput
.
setValue
(
"
Dyson
"
);
expect
(
titleInput
.
element
.
value
).
toBe
(
"
Dyson
"
);
const
selectedCategory
=
wrapper
.
find
(
'
#categories
'
);
await
selectedCategory
.
setValue
(
"
Hage
"
);
expect
(
selectedCategory
.
element
.
value
).
toBe
(
"
Hage
"
);
const
priceInput
=
wrapper
.
find
(
'
#price
'
);
await
priceInput
.
setValue
(
500
);
expect
(
priceInput
.
element
.
value
).
toBe
(
"
500
"
);
const
descriptionInput
=
wrapper
.
find
(
'
#description
'
);
await
descriptionInput
.
setValue
(
"
Dette er en støvsuer fra Dyson
"
);
expect
(
descriptionInput
.
element
.
value
).
toBe
(
"
Dette er en støvsuer fra Dyson
"
);
});
it
(
"
renders all labels
"
,
()
=>
{
const
wrapper
=
shallowMount
(
AddNewItem
);
expect
(
wrapper
.
find
(
"
#titleLabel
"
).
text
()).
toMatch
(
"
Tittel
"
);
expect
(
wrapper
.
find
(
"
#selectCategoryLabel
"
).
text
()).
toMatch
(
"
Kategori
"
);
expect
(
wrapper
.
find
(
"
#priceLabel
"
).
text
()).
toMatch
(
"
Pris
"
);
expect
(
wrapper
.
find
(
"
#descriptionLabel
"
).
text
()).
toMatch
(
"
Beskrivelse
"
);
expect
(
wrapper
.
find
(
"
#imageLabel
"
).
text
()).
toMatch
(
"
Bilde
"
);
});
it
(
"
Tests setting values of input field
"
,
async
()
=>
{
const
wrapper
=
shallowMount
(
AddNewItem
);
const
titleInput
=
wrapper
.
find
(
"
#title
"
);
await
titleInput
.
setValue
(
"
Dyson
"
);
expect
(
titleInput
.
element
.
value
).
toBe
(
"
Dyson
"
);
const
selectedCategory
=
wrapper
.
find
(
"
#categories
"
);
await
selectedCategory
.
setValue
(
"
Hage
"
);
expect
(
selectedCategory
.
element
.
value
).
toBe
(
"
Hage
"
);
const
priceInput
=
wrapper
.
find
(
"
#price
"
);
await
priceInput
.
setValue
(
500
);
expect
(
priceInput
.
element
.
value
).
toBe
(
"
500
"
);
const
descriptionInput
=
wrapper
.
find
(
"
#description
"
);
await
descriptionInput
.
setValue
(
"
Dette er en støvsuer fra Dyson
"
);
expect
(
descriptionInput
.
element
.
value
).
toBe
(
"
Dette er en støvsuer fra Dyson
"
);
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment