@qoretechnologies/reqore 0.19.9 → 0.19.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,11 +35,18 @@ jobs:
35
35
  - name: Build
36
36
  id: build
37
37
  run: ./node_modules/.bin/tsc
38
- - name: Publish
39
- id: publish
40
- run: |
41
- ./node_modules/.bin/npm-cli-login -u ${{ secrets.NPM_USER }} -p '${{ secrets.NPM_PASSWORD }}' -e ${{ secrets.NPM_EMAIL }}
42
- npm publish --access public --tag beta
38
+ - uses: JS-DevTools/npm-publish@v1
39
+ with:
40
+ token: ${{ secrets.NPM_TOKEN }}
41
+ tag: beta
42
+ access: public
43
+ - name: Publish to Chromatic
44
+ uses: chromaui/action@v1
45
+ # Chromatic GitHub Action options
46
+ with:
47
+ token: ${{ secrets.GITHUB_TOKEN }}
48
+ # 👇 Chromatic projectToken, refer to the manage page to obtain it.
49
+ projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
43
50
  - name: Create a release
44
51
  id: release
45
52
  uses: actions/create-release@v1
package/.gitpod.yml CHANGED
@@ -1,17 +1,3 @@
1
- vscode:
2
- extensions:
3
- - oderwat.indent-rainbow
4
- - tombonnike.vscode-status-bar-format-toggle
5
- - usernamehw.errorlens
6
- - emmanuelbeziat.vscode-great-icons
7
- - esbenp.prettier-vscode
8
- - jpoissonnier.vscode-styled-components
9
- - streetsidesoftware.code-spell-checker
10
- - foxhoundn.synthax
11
- - alefragnani.bookmarks
12
- - tabnine.tabnine-vscode
13
- - akosyakov.gitpod-monitor
14
- - eamodio.gitlens
15
1
  tasks:
16
2
  - init: "yarn install"
17
3
  - command: "yarn storybook"
@@ -1,24 +1,126 @@
1
- import { render } from "@testing-library/react";
2
- import React from "react";
3
- import {
4
- ReqoreButton,
5
- ReqoreContent,
6
- ReqoreLayoutContent,
7
- ReqoreUIProvider
8
- } from "../src";
9
-
10
- test("Renders <Button /> properly", () => {
1
+ import { fireEvent, render } from '@testing-library/react';
2
+ import React from 'react';
3
+ import { ReqoreButton, ReqoreContent, ReqoreLayoutContent, ReqoreUIProvider } from '../src';
4
+
5
+ test('Renders <Button /> properly', () => {
6
+ render(
7
+ <ReqoreUIProvider>
8
+ <ReqoreLayoutContent>
9
+ <ReqoreContent>
10
+ <ReqoreButton minimal>Hello</ReqoreButton>
11
+ <ReqoreButton icon='4KFill'>Another</ReqoreButton>
12
+ </ReqoreContent>
13
+ </ReqoreLayoutContent>
14
+ </ReqoreUIProvider>
15
+ );
16
+
17
+ expect(document.querySelectorAll('.reqore-icon').length).toBe(1);
18
+ expect(document.querySelectorAll('.reqore-button').length).toBe(2);
19
+ });
20
+
21
+ test('Renders <Button /> with size properly', () => {
22
+ render(
23
+ <ReqoreUIProvider>
24
+ <ReqoreLayoutContent>
25
+ <ReqoreContent>
26
+ <ReqoreButton size='tiny'>Tiny</ReqoreButton>
27
+ <ReqoreButton size='small'>Small</ReqoreButton>
28
+ <ReqoreButton size='big'>Big</ReqoreButton>
29
+ <ReqoreButton size='huge'>Huge</ReqoreButton>
30
+ </ReqoreContent>
31
+ </ReqoreLayoutContent>
32
+ </ReqoreUIProvider>
33
+ );
34
+
35
+ expect(document.querySelectorAll('.reqore-button').length).toBe(4);
36
+ });
37
+
38
+ test('Renders <Button /> with icon properly', () => {
39
+ render(
40
+ <ReqoreUIProvider>
41
+ <ReqoreLayoutContent>
42
+ <ReqoreContent>
43
+ <ReqoreButton icon='4KFill'>4K</ReqoreButton>
44
+ <ReqoreButton icon='24HoursFill'>24</ReqoreButton>
45
+ <ReqoreButton icon='BallPenFill'>Pen</ReqoreButton>
46
+ </ReqoreContent>
47
+ </ReqoreLayoutContent>
48
+ </ReqoreUIProvider>
49
+ );
50
+
51
+ expect(document.querySelectorAll('.reqore-icon').length).toBe(3);
52
+ expect(document.querySelectorAll('.reqore-button').length).toBe(3);
53
+ });
54
+
55
+ test('Renders <Button /> with intent properly', () => {
11
56
  render(
12
57
  <ReqoreUIProvider>
13
58
  <ReqoreLayoutContent>
14
59
  <ReqoreContent>
15
- <ReqoreButton minimal>Hello</ReqoreButton>
16
- <ReqoreButton icon="4KFill">Another</ReqoreButton>
60
+ <ReqoreButton intent='pending'>Pending</ReqoreButton>
61
+ <ReqoreButton intent='info'>Info</ReqoreButton>
62
+ <ReqoreButton intent='success'>Success</ReqoreButton>
63
+ <ReqoreButton intent='warning'>Warning</ReqoreButton>
64
+ <ReqoreButton intent='danger'>Danger</ReqoreButton>
65
+ </ReqoreContent>
66
+ </ReqoreLayoutContent>
67
+ </ReqoreUIProvider>
68
+ );
69
+
70
+ expect(document.querySelectorAll('.reqore-button').length).toBe(5);
71
+ });
72
+
73
+ test('Renders <Button /> with right icon properly', () => {
74
+ render(
75
+ <ReqoreUIProvider>
76
+ <ReqoreLayoutContent>
77
+ <ReqoreContent>
78
+ <ReqoreButton rightIcon='4KFill'>4K</ReqoreButton>
79
+ <ReqoreButton rightIcon='24HoursFill'>24</ReqoreButton>
80
+ <ReqoreButton rightIcon='BallPenFill'>Pen</ReqoreButton>
81
+ </ReqoreContent>
82
+ </ReqoreLayoutContent>
83
+ </ReqoreUIProvider>
84
+ );
85
+
86
+ expect(document.querySelectorAll('.reqore-button').length).toBe(3);
87
+ });
88
+
89
+ test('Renders <Button /> with icon and right icon properly', () => {
90
+ render(
91
+ <ReqoreUIProvider>
92
+ <ReqoreLayoutContent>
93
+ <ReqoreContent>
94
+ <ReqoreButton icon='4KFill' rightIcon='24HoursFill'>
95
+ 4K
96
+ </ReqoreButton>
97
+ <ReqoreButton icon='24HoursFill' rightIcon='BallPenFill'>
98
+ 24
99
+ </ReqoreButton>
100
+ <ReqoreButton icon='BallPenFill' rightIcon='4KFill'>
101
+ Pen
102
+ </ReqoreButton>
103
+ </ReqoreContent>
104
+ </ReqoreLayoutContent>
105
+ </ReqoreUIProvider>
106
+ );
107
+
108
+ expect(document.querySelectorAll('.reqore-button').length).toBe(3);
109
+ });
110
+
111
+ // A test that tests the onClick function of the button using fireEvent
112
+ test('Renders <Button /> with onClick function', () => {
113
+ const onClick = jest.fn();
114
+ const { getAllByText } = render(
115
+ <ReqoreUIProvider>
116
+ <ReqoreLayoutContent>
117
+ <ReqoreContent>
118
+ <ReqoreButton onClick={onClick}>Click</ReqoreButton>
17
119
  </ReqoreContent>
18
120
  </ReqoreLayoutContent>
19
121
  </ReqoreUIProvider>
20
122
  );
21
123
 
22
- expect(document.querySelectorAll(".reqore-icon").length).toBe(1);
23
- expect(document.querySelectorAll(".reqore-button").length).toBe(2);
124
+ fireEvent.click(getAllByText('Click')[0]);
125
+ expect(onClick).toHaveBeenCalledTimes(1);
24
126
  });
@@ -1,11 +1,6 @@
1
1
  import { fireEvent, render } from '@testing-library/react';
2
2
  import React from 'react';
3
- import {
4
- ReqoreContent,
5
- ReqoreDrawer,
6
- ReqoreLayoutContent,
7
- ReqoreUIProvider,
8
- } from '../src';
3
+ import { ReqoreContent, ReqoreDrawer, ReqoreLayoutContent, ReqoreUIProvider } from '../src';
9
4
 
10
5
  test('Does not render <Drawer /> if not open', () => {
11
6
  render(