Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
e6b8cacb
Commit
e6b8cacb
authored
Jun 30, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix suggest item clashing
parent
be1ef124
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
SearchBar.pw.tsx
ui/snippets/searchBar/SearchBar.pw.tsx
+14
-10
SearchBarSuggest.tsx
ui/snippets/searchBar/SearchBarSuggest.tsx
+4
-4
No files found.
ui/snippets/searchBar/SearchBar.pw.tsx
View file @
e6b8cacb
...
@@ -162,23 +162,23 @@ test('search by tx hash +@mobile', async({ mount, page }) => {
...
@@ -162,23 +162,23 @@ test('search by tx hash +@mobile', async({ mount, page }) => {
});
});
test
(
'
search with simple match
'
,
async
({
mount
,
page
})
=>
{
test
(
'
search with simple match
'
,
async
({
mount
,
page
})
=>
{
const
API_URL
=
buildApiUrl
(
'
search
'
)
+
`?q=
${
searchMock
.
t
x1
.
tx_hash
}
`
;
const
API_URL
=
buildApiUrl
(
'
search
'
)
+
`?q=
${
searchMock
.
t
oken2
.
name
}
`
;
const
API_CHECK_REDIRECT_URL
=
buildApiUrl
(
'
search_check_redirect
'
)
+
`?q=
${
searchMock
.
t
x1
.
tx_hash
}
`
;
const
API_CHECK_REDIRECT_URL
=
buildApiUrl
(
'
search_check_redirect
'
)
+
`?q=
${
searchMock
.
t
oken2
.
name
}
`
;
await
page
.
route
(
API_URL
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
status
:
200
,
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
items
:
[
items
:
[
searchMock
.
t
x1
,
searchMock
.
t
oken2
,
],
],
}),
}),
}));
}));
await
page
.
route
(
API_CHECK_REDIRECT_URL
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
API_CHECK_REDIRECT_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
status
:
200
,
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
parameter
:
searchMock
.
t
x1
.
tx_hash
,
parameter
:
searchMock
.
t
oken2
.
address
,
redirect
:
true
,
redirect
:
true
,
type
:
'
transaction
'
,
type
:
'
address
'
,
}),
}),
}));
}));
...
@@ -187,14 +187,18 @@ test('search with simple match', async({ mount, page }) => {
...
@@ -187,14 +187,18 @@ test('search with simple match', async({ mount, page }) => {
<
SearchBar
/>
<
SearchBar
/>
</
TestApp
>,
</
TestApp
>,
);
);
await
page
.
getByPlaceholder
(
/search/i
).
type
(
searchMock
.
t
x1
.
tx_hash
);
await
page
.
getByPlaceholder
(
/search/i
).
type
(
searchMock
.
t
oken2
.
name
);
await
page
.
waitForResponse
(
API_URL
);
await
page
.
waitForResponse
(
API_URL
);
await
page
.
waitForResponse
(
API_CHECK_REDIRECT_URL
);
const
resultText
=
page
.
getByText
(
'
Found 2 matching result
'
);
await
expect
(
resultText
).
toBeVisible
();
const
resultText
=
page
.
getByText
(
'
Found 1 matching result
'
);
const
linkToToken
=
page
.
getByText
(
searchMock
.
token2
.
name
);
expect
(
resultText
).
toBeTruthy
(
);
await
expect
(
linkToToken
).
toHaveCount
(
1
);
const
link
s
=
page
.
getByText
(
searchMock
.
tx1
.
tx_hash
);
const
link
ToAddress
=
page
.
getByText
(
searchMock
.
token2
.
address
);
await
expect
(
link
s
).
toHaveCount
(
1
);
await
expect
(
link
ToAddress
).
toHaveCount
(
2
);
});
});
test
(
'
recent keywords suggest +@mobile
'
,
async
({
mount
,
page
})
=>
{
test
(
'
recent keywords suggest +@mobile
'
,
async
({
mount
,
page
})
=>
{
...
...
ui/snippets/searchBar/SearchBarSuggest.tsx
View file @
e6b8cacb
...
@@ -16,16 +16,16 @@ const getUniqueIdentifier = (item: SearchResultItem) => {
...
@@ -16,16 +16,16 @@ const getUniqueIdentifier = (item: SearchResultItem) => {
switch
(
item
.
type
)
{
switch
(
item
.
type
)
{
case
'
contract
'
:
case
'
contract
'
:
case
'
address
'
:
{
case
'
address
'
:
{
return
item
.
address
;
return
item
.
type
+
item
.
address
;
}
}
case
'
transaction
'
:
{
case
'
transaction
'
:
{
return
item
.
tx_hash
;
return
item
.
t
ype
+
item
.
t
x_hash
;
}
}
case
'
block
'
:
{
case
'
block
'
:
{
return
item
.
block_hash
||
item
.
block_number
;
return
item
.
type
+
(
item
.
block_hash
||
item
.
block_number
)
;
}
}
case
'
token
'
:
{
case
'
token
'
:
{
return
item
.
address
;
return
item
.
type
+
item
.
address
;
}
}
}
}
};
};
...
...
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