@qoretechnologies/reqore 0.19.8 → 0.19.12

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.
@@ -19,6 +19,8 @@ jobs:
19
19
  steps:
20
20
  # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
21
21
  - uses: actions/checkout@v2
22
+ with:
23
+ fetch-depth: 0
22
24
  - uses: actions/setup-node@v1
23
25
  with:
24
26
  node-version: 14.16.0
@@ -31,15 +33,28 @@ jobs:
31
33
  - name: Installing modules
32
34
  id: install_modules
33
35
  run: |
36
+ yarn cache clean
37
+ rm -rf node_modules
34
38
  yarn install
39
+ - name: Running tests
40
+ id: tests
41
+ run: yarn test:ci
35
42
  - name: Build
36
43
  id: build
37
44
  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
45
+ - name: Publish to NPM
46
+ id: npm_publish
47
+ uses: JS-DevTools/npm-publish@v1
48
+ with:
49
+ token: ${{ secrets.NPM_TOKEN }}
50
+ tag: beta
51
+ access: public
52
+ - name: Publish to Chromatic
53
+ id: chromatic_publish
54
+ uses: chromaui/action@v1
55
+ with:
56
+ token: ${{ secrets.GITHUB_TOKEN }}
57
+ projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
43
58
  - name: Create a release
44
59
  id: release
45
60
  uses: actions/create-release@v1
@@ -20,6 +20,8 @@ jobs:
20
20
  steps:
21
21
  # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
22
22
  - uses: actions/checkout@v2
23
+ with:
24
+ fetch-depth: 0
23
25
  - uses: actions/setup-node@v1
24
26
  with:
25
27
  node-version: 14.16.0
@@ -38,6 +40,13 @@ jobs:
38
40
  - name: Running tests
39
41
  id: tests
40
42
  run: yarn test:ci
43
+ - name: Publish to Chromatic
44
+ id: chromatic_publish
45
+ uses: chromaui/action@v1
46
+ with:
47
+ token: ${{ secrets.GITHUB_TOKEN }}
48
+ projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
49
+ exitZeroOnChanges: true
41
50
  - name: Slack notification
42
51
  uses: Foxhoundn/slack@v1.2.94
43
52
  with:
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"
@@ -0,0 +1 @@
1
+ {"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":2,"numPassedTests":12,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":2,"numTotalTests":12,"openHandles":[],"snapshot":{"added":0,"didUpdate":false,"failure":false,"filesAdded":0,"filesRemoved":0,"filesRemovedList":[],"filesUnmatched":0,"filesUpdated":0,"matched":0,"total":0,"unchecked":0,"uncheckedKeysByFile":[],"unmatched":0,"updated":0},"startTime":1640860411341,"success":true,"testResults":[{"assertionResults":[{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Button /> properly","location":null,"status":"passed","title":"Renders <Button /> properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Button /> with size properly","location":null,"status":"passed","title":"Renders <Button /> with size properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Button /> with icon properly","location":null,"status":"passed","title":"Renders <Button /> with icon properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Button /> with intent properly","location":null,"status":"passed","title":"Renders <Button /> with intent properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Button /> with right icon properly","location":null,"status":"passed","title":"Renders <Button /> with right icon properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Button /> with icon and right icon properly","location":null,"status":"passed","title":"Renders <Button /> with icon and right icon properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Button /> with onClick function","location":null,"status":"passed","title":"Renders <Button /> with onClick function"}],"endTime":1640860416953,"message":"","name":"/workspace/reqore/__tests__/button.test.tsx","startTime":1640860412163,"status":"passed","summary":""},{"assertionResults":[{"ancestorTitles":[],"failureMessages":[],"fullName":"Does not render <Drawer /> if not open","location":null,"status":"passed","title":"Does not render <Drawer /> if not open"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders opened <Drawer /> properly","location":null,"status":"passed","title":"Renders opened <Drawer /> properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders hidable <Drawer /> properly","location":null,"status":"passed","title":"Renders hidable <Drawer /> properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders closable <Drawer /> properly","location":null,"status":"passed","title":"Renders closable <Drawer /> properly"},{"ancestorTitles":[],"failureMessages":[],"fullName":"Renders <Drawer /> with interactive backdrop","location":null,"status":"passed","title":"Renders <Drawer /> with interactive backdrop"}],"endTime":1640860417371,"message":"","name":"/workspace/reqore/__tests__/drawer.test.tsx","startTime":1640860412108,"status":"passed","summary":""}],"wasInterrupted":false}
@@ -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(