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
2b16c158
Commit
2b16c158
authored
Dec 15, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tooltip tests
parent
d6cc7dfa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
19 deletions
+60
-19
tasks.json
.vscode/tasks.json
+14
-14
Tooltip.pw.tsx
theme/components/Tooltip/Tooltip.pw.tsx
+43
-0
Tooltip.ts
theme/components/Tooltip/Tooltip.ts
+2
-4
Tooltip.pw.tsx_dark-color-mode_base-view-dark-mode-1.png
.../Tooltip.pw.tsx_dark-color-mode_base-view-dark-mode-1.png
+0
-0
Tooltip.pw.tsx_default_base-view-dark-mode-1.png
...nshots__/Tooltip.pw.tsx_default_base-view-dark-mode-1.png
+0
-0
index.ts
theme/components/index.ts
+1
-1
No files found.
.vscode/tasks.json
View file @
2b16c158
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
"detail"
:
"start local dev server"
,
"detail"
:
"start local dev server"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"silent"
,
"reveal"
:
"silent"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
},
},
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"detail"
:
"start local dev server for POA network"
,
"detail"
:
"start local dev server for POA network"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"silent"
,
"reveal"
:
"silent"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
},
},
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
"detail"
:
"start local dev server for Goerli network"
,
"detail"
:
"start local dev server for Goerli network"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"silent"
,
"reveal"
:
"silent"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
},
},
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
},
},
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"never"
,
"reveal"
:
"never"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
},
},
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
"detail"
:
"run eslint"
,
"detail"
:
"run eslint"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"silent"
,
"reveal"
:
"silent"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
},
},
"icon"
:
{
"icon"
:
{
...
@@ -112,7 +112,7 @@
...
@@ -112,7 +112,7 @@
"detail"
:
"run visual components tests for current file"
,
"detail"
:
"run visual components tests for current file"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"focus"
:
true
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
...
@@ -131,7 +131,7 @@
...
@@ -131,7 +131,7 @@
"detail"
:
"run visual components tests for current file"
,
"detail"
:
"run visual components tests for current file"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"focus"
:
true
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
...
@@ -150,7 +150,7 @@
...
@@ -150,7 +150,7 @@
"detail"
:
"run visual components tests"
,
"detail"
:
"run visual components tests"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"focus"
:
true
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
...
@@ -171,7 +171,7 @@
...
@@ -171,7 +171,7 @@
"detail"
:
"run jest tests"
,
"detail"
:
"run jest tests"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"focus"
:
true
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
...
@@ -190,7 +190,7 @@
...
@@ -190,7 +190,7 @@
"detail"
:
"run jest tests in watch mode"
,
"detail"
:
"run jest tests in watch mode"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"focus"
:
true
,
"focus"
:
true
,
},
},
...
@@ -210,7 +210,7 @@
...
@@ -210,7 +210,7 @@
"detail"
:
"run jest tests in watch mode for current file"
,
"detail"
:
"run jest tests in watch mode for current file"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"focus"
:
true
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
"detail"
:
"build docker image"
,
"detail"
:
"build docker image"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
"focus"
:
true
,
"focus"
:
true
,
...
@@ -251,7 +251,7 @@
...
@@ -251,7 +251,7 @@
"detail"
:
"run docker container for POA network"
,
"detail"
:
"run docker container for POA network"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"silent"
,
"reveal"
:
"silent"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
},
},
...
@@ -271,7 +271,7 @@
...
@@ -271,7 +271,7 @@
"detail"
:
"format svg files with svgo"
,
"detail"
:
"format svg files with svgo"
,
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"silent"
,
"reveal"
:
"silent"
,
"panel"
:
"
dedicat
ed"
,
"panel"
:
"
shar
ed"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
},
},
...
...
theme/components/Tooltip/Tooltip.pw.tsx
0 → 100644
View file @
2b16c158
import
{
Box
,
Tooltip
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
TestApp
from
'
playwright/TestApp
'
;
test
(
'
base view +@dark-mode
'
,
async
({
mount
,
page
})
=>
{
const
component
=
await
mount
(
<
TestApp
>
<
Box
m=
{
10
}
>
<
Tooltip
label=
"Tooltip content"
>
trigger
</
Tooltip
>
</
Box
>
</
TestApp
>,
);
await
component
.
getByText
(
/trigger/i
).
hover
();
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
40
,
width
:
130
,
height
:
64
}
});
});
// was not able to reproduce in tests issue when Icon is used as trigger for tooltip
// https://github.com/chakra-ui/chakra-ui/issues/7107
test
.
skip
(
'
with icon
'
,
async
({
mount
,
page
})
=>
{
const
component
=
await
mount
(
<
TestApp
>
<
Box
m=
{
10
}
>
<
Tooltip
label=
"Tooltip content"
>
<
Icon
viewBox=
"0 0 20 20"
boxSize=
{
5
}
aria
-
label=
"Trigger"
>
<
circle
cx=
"10"
cy=
"10"
r=
"10"
/>
</
Icon
>
</
Tooltip
>
</
Box
>
</
TestApp
>,
);
const
tooltip
=
page
.
getByText
(
/tooltip content/i
);
expect
(
await
tooltip
.
isVisible
()).
toBe
(
false
);
await
component
.
locator
(
'
svg[aria-label="Trigger"]
'
).
hover
();
expect
(
await
tooltip
.
isVisible
()).
toBe
(
true
);
});
theme/components/Tooltip.ts
→
theme/components/Tooltip
/Tooltip
.ts
View file @
2b16c158
...
@@ -2,8 +2,6 @@ import { Tooltip as TooltipComponent } from '@chakra-ui/react';
...
@@ -2,8 +2,6 @@ import { Tooltip as TooltipComponent } from '@chakra-ui/react';
import
{
defineStyle
,
defineStyleConfig
}
from
'
@chakra-ui/styled-system
'
;
import
{
defineStyle
,
defineStyleConfig
}
from
'
@chakra-ui/styled-system
'
;
import
{
mode
,
cssVar
}
from
'
@chakra-ui/theme-tools
'
;
import
{
mode
,
cssVar
}
from
'
@chakra-ui/theme-tools
'
;
// these cause console warning about kebab-case in naming of css variables
// but the chakra-ui itself uses the same variable names, and i guess we cannot override them
const
$bg
=
cssVar
(
'
tooltip-bg
'
);
const
$bg
=
cssVar
(
'
tooltip-bg
'
);
const
$fg
=
cssVar
(
'
tooltip-fg
'
);
const
$fg
=
cssVar
(
'
tooltip-fg
'
);
const
$arrowBg
=
cssVar
(
'
popper-arrow-bg
'
);
const
$arrowBg
=
cssVar
(
'
popper-arrow-bg
'
);
...
@@ -33,9 +31,9 @@ const baseStyle = defineStyle((props) => {
...
@@ -33,9 +31,9 @@ const baseStyle = defineStyle((props) => {
return
{
return
{
bg
:
$bg
.
reference
,
bg
:
$bg
.
reference
,
color
:
mode
(
'
white
'
,
'
black
'
)(
props
)
,
color
:
$fg
.
reference
,
[
$bg
.
variable
]:
`colors.
${
bg
}
`
,
[
$bg
.
variable
]:
`colors.
${
bg
}
`
,
[
$fg
.
referenc
e
]:
`colors.
${
fg
}
`
,
[
$fg
.
variabl
e
]:
`colors.
${
fg
}
`
,
[
$arrowBg
.
variable
]:
$bg
.
reference
,
[
$arrowBg
.
variable
]:
$bg
.
reference
,
maxWidth
:
props
.
maxWidth
||
props
.
maxW
||
'
unset
'
,
maxWidth
:
props
.
maxWidth
||
props
.
maxW
||
'
unset
'
,
};
};
...
...
theme/components/Tooltip/__screenshots__/Tooltip.pw.tsx_dark-color-mode_base-view-dark-mode-1.png
0 → 100644
View file @
2b16c158
3.87 KB
theme/components/Tooltip/__screenshots__/Tooltip.pw.tsx_default_base-view-dark-mode-1.png
0 → 100644
View file @
2b16c158
3.95 KB
theme/components/index.ts
View file @
2b16c158
...
@@ -19,7 +19,7 @@ import Tabs from './Tabs';
...
@@ -19,7 +19,7 @@ import Tabs from './Tabs';
import
Tag
from
'
./Tag
'
;
import
Tag
from
'
./Tag
'
;
import
Text
from
'
./Text
'
;
import
Text
from
'
./Text
'
;
import
Textarea
from
'
./Textarea
'
;
import
Textarea
from
'
./Textarea
'
;
import
Tooltip
from
'
./Tooltip
'
;
import
Tooltip
from
'
./Tooltip
/Tooltip
'
;
const
components
=
{
const
components
=
{
Alert
,
Alert
,
...
...
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