Skip to content

Commit

Permalink
Merge pull request #501 from jakub300/rewrite-with-webpack-update-tests
Browse files Browse the repository at this point in the history
Minify Styles & Update Tests
  • Loading branch information
edenizk authored Jul 19, 2021
2 parents 7219131 + 51ef219 commit 53090e8
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 249 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_js:
- 10.14.2
- 10
- 12
- 14
cache:
yarn: true
# addons:
Expand All @@ -17,6 +18,7 @@ services:
before_script:
- yarn prepare-links
- cd packages/chisel-plugin-wordpress; yarn prepare; cd -;
- export FORCE_COLOR=3

after_script:
- npm install -g codecov
Expand Down
220 changes: 140 additions & 80 deletions __tests__/fe/__snapshots__/add-page.js.snap

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions __tests__/fe/build/__snapshots__/0.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Array [
scripts/app.98db252c.full.js 4.41 KiB 1.35 KiB
scripts/app.98db252c.js 1.18 KiB 0.59 KiB
[34mstyles/main.--HASH--.full.css[39m 18.52 KiB 4.79 KiB
[34mstyles/main.--HASH--.css[39m 5.20 KiB 1.86 KiB
[34mstyles/main.--HASH--.full.css[39m 18.92 KiB 4.85 KiB
[34mstyles/main.--HASH--.css[39m 5.25 KiB 1.88 KiB
Images and other types of assets omitted.
",
Expand All @@ -36,8 +36,8 @@ Array [
scripts/app.98db252c.full.js 4.41 KiB 1.35 KiB
scripts/app.98db252c.js 1.18 KiB 0.59 KiB
[34mstyles/main.--HASH--.full.css[39m 18.52 KiB 4.79 KiB
[34mstyles/main.--HASH--.css[39m 5.20 KiB 1.86 KiB
[34mstyles/main.--HASH--.full.css[39m 18.92 KiB 4.85 KiB
[34mstyles/main.--HASH--.css[39m 5.25 KiB 1.88 KiB
Images and other types of assets omitted.
",
Expand Down
3 changes: 2 additions & 1 deletion __tests__/wp/__snapshots__/wp-config.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Array [
"",
],
Array [
"ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (--ERROR-DETAILS-)",
"Error: Failed to get current SQL modes. Reason: ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (--ERROR-DETAILS-)
",
],
Array [
"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,162 +10,7 @@
>
<!-- prettier-ignore -->
<style>
html {
font-size: 1em;
line-height: 1.5;
}

@media (min-width:768px) {
html {
font-size: 1.25em
}
}

@media (min-width:1024px) {
html {
font-size: 1.5em
}
}

body {
background: #fff;
color: #2a1468;
font-family: Quicksand, sans-serif;
padding: 1em
}

a,
a:link {
color: #2a1468;
text-decoration: underline;
}

a:hover {
color: #ff6d54;
}

p {
margin: 0 0 1em
}

.c-wrapper {
margin: 0 auto;
max-width: 860px
}

.c-section {
margin-top: 0.5em;
}

.c-section__content {
font-size: 0.75em;
}

.c-section__text a {
font-weight: 500;
}

.c-section__intro {
font-size: 1em;
font-weight: 600;
}

.c-section:last-child {
margin-top: 2em;
}

.c-section__note {
margin-top: 1em
}

.c-section__note:not(:last-child) {
display: none
}

.c-page-title {
margin: 0;
font-size: 1.5em;
}

.c-page-subtitle {
margin: 1.5em 0 0;
font-size: 1em;
}

.c-page-subtitle,
.c-heading {
border-bottom: 3px solid #ff6d54;
display: inline-block;
font-weight: 600;
}

.c-intro {
font-size: 1em;
font-weight: 600;
margin: 0 1em 1.9em 0;
line-height: 1.5;
}

.c-heading {
margin: 0 0 .5em;
font-size: 1.35em;
}

.c-list {
list-style: none;
margin: 0;
padding: 0
}

.c-list li {
margin-bottom: .5em;
padding-left: 1em;
position: relative
}

.c-list li:before {
background: #ff6d54;
content: "";
display: block;
height: .5em;
left: 0;
position: absolute;
top: .5em;
width: .5em
}

.c-page {
text-decoration: none;
position: relative;
display: block;
border-bottom: 1px dashed #ccc;
padding-bottom: .5em
}

.c-page__link {
font-weight: 600;
}

.c-page__name {
color: #2a1468;
margin-left: .5em;
position: absolute;
top: 0;
right: 0
}

.c-page:hover .c-page__name {
color: #ff6d54
}

.c-section__code {
padding: 0.9rem 0.8rem;
overflow: auto;
display: block;
background: #2d2b57;
color: #e3dfff;
border-radius: 10px;
}
html{font-size:1em;line-height:1.5}@media (min-width:768px){html{font-size:1.25em}}@media (min-width:1024px){html{font-size:1.5em}}body{background:#fff;color:#2a1468;font-family:Quicksand,sans-serif;padding:1em}a,a:link{color:#2a1468;text-decoration:underline}a:hover{color:#ff6d54}p{margin:0 0 1em}.c-wrapper{margin:0 auto;max-width:860px}.c-section{margin-top:.5em}.c-section__content{font-size:.75em}.c-section__text a{font-weight:500}.c-section__intro{font-size:1em;font-weight:600}.c-section:last-child{margin-top:2em}.c-section__note{margin-top:1em}.c-section__note:not(:last-child){display:none}.c-page-title{margin:0;font-size:1.5em}.c-page-subtitle{margin:1.5em 0 0;font-size:1em}.c-heading,.c-page-subtitle{border-bottom:3px solid #ff6d54;display:inline-block;font-weight:600}.c-intro{font-size:1em;font-weight:600;margin:0 1em 1.9em 0;line-height:1.5}.c-heading{margin:0 0 .5em;font-size:1.35em}.c-list{list-style:none;margin:0;padding:0}.c-list li{margin-bottom:.5em;padding-left:1em;position:relative}.c-list li:before{background:#ff6d54;content:"";display:block;height:.5em;left:0;position:absolute;top:.5em;width:.5em}.c-page{text-decoration:none;position:relative;display:block;border-bottom:1px dashed #ccc;padding-bottom:.5em}.c-page__link{font-weight:600}.c-page__name{color:#2a1468;margin-left:.5em;position:absolute;top:0;right:0}.c-page:hover .c-page__name{color:#ff6d54}.c-section__code{padding:.9rem .8rem;overflow:auto;display:block;background:#2d2b57;color:#e3dfff;border-radius:10px}
</style>
<script type="text/x-chisel-pages-template">
<ul class="c-list">
Expand Down
18 changes: 10 additions & 8 deletions scripts/testSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@ global.chiselTestHelpers = {
});

if (consoleMock.mock.calls[1] && consoleMock.mock.calls[1][0]) {
// in Ci in Node 12 there is difference in gzip compression
// ex. https://travis-ci.org/github/xfiveco/generator-chisel/jobs/712710842
if (parseInt(process.versions.node.split('.')[0], 10) >= '12') {
consoleMock.mock.calls[1][0] = consoleMock.mock.calls[1][0].replace(
'4.78 KiB',
'4.79 KiB',
);
// in Ci in Node 12 and 14 there is difference in gzip compression
// ex. https://travis-ci.com/github/jakub300/generator-chisel/builds/231019589
const nodeVersion = parseInt(process.versions.node.split('.')[0], 10);
const call = consoleMock.mock.calls[1][0];
if (nodeVersion === 10) {
consoleMock.mock.calls[1][0] = call.replace('4.86 KiB', '4.85 KiB');
} else if (nodeVersion === 12) {
consoleMock.mock.calls[1][0] = call.replace('1.87 KiB', '1.88 KiB');
}
}
},
Expand All @@ -185,7 +186,8 @@ global.chiselTestHelpers = {
.replace(/dbrand\d+/g, '--DB-RAND--')
.split(process.cwd())
.join('--PROJECT-PATH--')
.replace(/(?<=--PROJECT-PATH--)\\/g, '/'),
.replace(/(?<=--PROJECT-PATH--)\\/g, '/')
.replace(/Copyright &copy; 202\d /g, 'Copyright &copy; 2020 '),
).toMatchSnapshot();
},

Expand Down

0 comments on commit 53090e8

Please sign in to comment.