Skip to content

Commit 2e3fb92

Browse files
authored
Implemented align items feature
* Fixed bettercodehub config and excluded yml files from prettier task * Added keywords to the package config * Added snapshot tests for index modules and added a test config * Updated yarn.lock file * Improved tslint config and added tslint-sonarts * Removed vendor prefixes and fully trust on styled-components doing its job right * Implemented align items feature
1 parent 16c35fa commit 2e3fb92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+555
-360
lines changed

.bettercodehub.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
component_depth: 2;
1+
component_depth: 2

jest.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
],
77
"coverageReporters": ["cobertura", "lcov"],
88
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
9+
"setupTestFrameworkScriptFile": "./test.config.ts",
910
"snapshotSerializers": ["enzyme-to-json/serializer"],
1011
"testRegex": ".*?\\.(spec|test)\\.(jsx?|tsx?)$",
1112
"testResultsProcessor": "jest-junit",

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-rasta",
3-
"version": "0.3.0",
3+
"version": "1.0.0",
44
"description": "The most powerful and flexible grid system for React",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",
@@ -11,12 +11,13 @@
1111
},
1212
"author": "ChilliCream",
1313
"license": "MIT",
14+
"keywords": ["grid", "layout", "css", "flexbox"],
1415
"scripts": {
1516
"build": "yarn prettier && yarn lint && yarn test:coverage && tsc",
1617
"build-storybook": "build-storybook",
1718
"cover": "coveralls < coverage/lcov.info",
1819
"lint": "tslint -c tslint.json 'src/**/*.ts*'",
19-
"prettier": "prettier \"./*.+(js|json|md|yml)\" \"./src/**/*.*\" --write",
20+
"prettier": "prettier \"./*.+(js|json|md)\" \"./src/**/*.*\" --write",
2021
"storybook": "start-storybook -p 6006",
2122
"test": "jest --config jest.config.json",
2223
"test:coverage": "jest --coverage --config jest.config.json"
@@ -54,6 +55,7 @@
5455
"ts-jest": "^22.0.1",
5556
"tslint": "^5.9.1",
5657
"tslint-react": "^3.3.3",
58+
"tslint-sonarts": "^1.6.0",
5759
"typescript": "^2.8.1"
5860
},
5961
"dependencies": {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`index should verify the API shape 1`] = `
4+
Object {
5+
"BreakpointMap": Object {},
6+
"BreakpointValue": Object {},
7+
"BreakpointValues": Object {},
8+
"Column": [Function],
9+
"Container": [Function],
10+
"Row": [Function],
11+
"Theme": Object {},
12+
"ThemeProvider": [Function],
13+
}
14+
`;

src/column/Column.test.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
// Module mocks must mocked before importing modules
2-
jest.mock("../utils/bootstrap", () => jest.fn());
3-
41
import "jest-styled-components";
5-
import { configure, shallow } from "enzyme";
6-
import * as Adapter from "enzyme-adapter-react-16";
2+
import { shallow } from "enzyme";
73
import * as React from "react";
84
import styled from "styled-components";
95
import Column from "./Column";
106

11-
configure({ adapter: new Adapter() });
12-
137
describe("<Column />", () => {
148
it("should match the snapshot (no properties set)", () => {
159
// act

src/column/Column.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// These imports are needed for declaration files
2-
import * as _React from "react";
3-
import * as _StyledComponents from "styled-components";
4-
// -------------------------------------------------------------------
51
import "../utils/bootstrap";
2+
import { ClassAttributes, HTMLAttributes } from "react";
3+
import { StyledComponentClass } from "styled-components";
64
import ColumnProperties from "./ColumnProperties";
75
import ColumnOffset from "./ColumnOffset";
86
import ColumnOrder from "./ColumnOrder";

src/column/__snapshots__/Column.test.tsx.snap

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,9 @@ exports[
6868
width: 100%;
6969
min-height: 1px;
7070
margin-left: 25.000000%;
71-
-webkit-box-ordinal-group: 3;
72-
-ms-flex-order: 2;
7371
-webkit-order: 2;
7472
-ms-flex-order: 2;
7573
order: 2;
76-
-webkit-box-flex: 0;
77-
-ms-flex: 0 0 75.000000%;
7874
-webkit-flex: 0 0 75.000000%;
7975
-ms-flex: 0 0 75.000000%;
8076
flex: 0 0 75.000000%;
@@ -96,17 +92,13 @@ exports[
9692
position: relative;
9793
width: 100%;
9894
min-height: 1px;
99-
-webkit-box-ordinal-group: 0;
100-
-ms-flex-order: -1;
10195
-webkit-order: -1;
10296
-ms-flex-order: -1;
10397
order: -1;
10498
}
10599
106100
@media (min-width:576px) {
107101
.c0 {
108-
-webkit-box-ordinal-group: 3;
109-
-ms-flex-order: 2;
110102
-webkit-order: 2;
111103
-ms-flex-order: 2;
112104
order: 2;
@@ -115,8 +107,6 @@ exports[
115107
116108
@media (min-width:768px) {
117109
.c0 {
118-
-webkit-box-ordinal-group: 13;
119-
-ms-flex-order: 12;
120110
-webkit-order: 12;
121111
-ms-flex-order: 12;
122112
order: 12;
@@ -140,8 +130,6 @@ exports[`<Column /> should match the snapshot (order: 5) 1`] = `
140130
position: relative;
141131
width: 100%;
142132
min-height: 1px;
143-
-webkit-box-ordinal-group: 5;
144-
-ms-flex-order: 4;
145133
-webkit-order: 4;
146134
-ms-flex-order: 4;
147135
order: 4;
@@ -153,39 +141,17 @@ exports[`<Column /> should match the snapshot (order: 5) 1`] = `
153141
/>
154142
`;
155143

156-
exports[`<Column /> should match the snapshot (size: 7) 1`] = `
157-
.c0 {
158-
position: relative;
159-
width: 100%;
160-
min-height: 1px;
161-
-webkit-box-flex: 0;
162-
-ms-flex: 0 0 58.333333%;
163-
-webkit-flex: 0 0 58.333333%;
164-
-ms-flex: 0 0 58.333333%;
165-
flex: 0 0 58.333333%;
166-
max-width: 58.333333%;
167-
}
168-
169-
<div
170-
className="c0"
171-
size={7}
172-
/>
173-
`;
174-
175144
exports[
176145
`<Column /> should match the snapshot (size: { xs: 'auto', sm: 7, md: 'none' }) 1`
177146
] = `
178147
.c0 {
179148
position: relative;
180149
width: 100%;
181150
min-height: 1px;
182-
-ms-flex-preferred-size: 0;
183151
-webkit-flex-basis: 0;
184152
-ms-flex-preferred-size: 0;
185153
flex-basis: 0;
186154
-webkit-box-flex: 1;
187-
-ms-flex-positive: 1;
188-
-webkit-box-flex: 1;
189155
-webkit-flex-grow: 1;
190156
-ms-flex-positive: 1;
191157
flex-grow: 1;
@@ -194,8 +160,6 @@ exports[
194160
195161
@media (min-width:576px) {
196162
.c0 {
197-
-webkit-box-flex: 0;
198-
-ms-flex: 0 0 58.333333%;
199163
-webkit-flex: 0 0 58.333333%;
200164
-ms-flex: 0 0 58.333333%;
201165
flex: 0 0 58.333333%;
@@ -205,8 +169,6 @@ exports[
205169
206170
@media (min-width:768px) {
207171
.c0 {
208-
-webkit-box-flex: 0;
209-
-ms-flex: 0 0 auto;
210172
-webkit-flex: 0 0 auto;
211173
-ms-flex: 0 0 auto;
212174
flex: 0 0 auto;
@@ -226,3 +188,20 @@ exports[
226188
}
227189
/>
228190
`;
191+
192+
exports[`<Column /> should match the snapshot (size: 7) 1`] = `
193+
.c0 {
194+
position: relative;
195+
width: 100%;
196+
min-height: 1px;
197+
-webkit-flex: 0 0 58.333333%;
198+
-ms-flex: 0 0 58.333333%;
199+
flex: 0 0 58.333333%;
200+
max-width: 58.333333%;
201+
}
202+
203+
<div
204+
className="c0"
205+
size={7}
206+
/>
207+
`;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`index should verify the API shape 1`] = `
4+
Object {
5+
"default": [Function],
6+
}
7+
`;

src/column/index.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import * as module from ".";
2+
3+
describe("index", () => {
4+
it("should verify the API shape", () => {
5+
expect(module).toMatchSnapshot();
6+
});
7+
});

src/column/renderOrder.test.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ describe("renderOrder", () => {
99
const output = renderOrder(input);
1010

1111
// assert
12-
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe(
13-
"-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1;"
14-
);
12+
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe("order:-1;");
1513
});
1614

1715
it("should render css for flex order (input: 0)", () => {
@@ -22,9 +20,7 @@ describe("renderOrder", () => {
2220
const output = renderOrder(input);
2321

2422
// assert
25-
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe(
26-
"-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1;"
27-
);
23+
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe("order:-1;");
2824
});
2925

3026
it("should render css for flex order (input: 5)", () => {
@@ -35,9 +31,7 @@ describe("renderOrder", () => {
3531
const output = renderOrder(input);
3632

3733
// assert
38-
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe(
39-
"-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4;"
40-
);
34+
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe("order:4;");
4135
});
4236

4337
it("should render css for flex order (input: 'last')", () => {
@@ -48,9 +42,7 @@ describe("renderOrder", () => {
4842
const output = renderOrder(input);
4943

5044
// assert
51-
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe(
52-
"-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12;"
53-
);
45+
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe("order:12;");
5446
});
5547

5648
it("should render css for flex order (input: 13)", () => {
@@ -61,8 +53,6 @@ describe("renderOrder", () => {
6153
const output = renderOrder(input);
6254

6355
// assert
64-
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe(
65-
"-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12;"
66-
);
56+
expect(output.replace(/\n|\r|\s|\t/gi, "")).toBe("order:12;");
6757
});
6858
});

0 commit comments

Comments
 (0)