Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add infrastructure for manual in browser testing
- Loading branch information
Showing
15 changed files
with
1,863 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/dist | ||
/test/cases | ||
/test/js | ||
/test/manual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title>mini-css-extract-plugin testcase</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="stylesheet" type="text/css" href="/dist/preloaded1.css" /> | ||
<style> | ||
.test { | ||
background: lightcoral; | ||
} | ||
.errors { | ||
font-weight: bold; | ||
color: darkred; | ||
} | ||
.preloaded-css1 { | ||
background: lightgreen; | ||
} | ||
</style> | ||
<style data-href="preloaded2.css"> | ||
.preloaded-css2 { | ||
background: lightgreen; | ||
} | ||
</style> | ||
<link rel="stylesheet" type="text/css" href="/dist/main.css" /> | ||
</head> | ||
<body> | ||
<div class="test initial-css"> | ||
Initial CSS: Must be green | ||
</div> | ||
<div class="test lazy-css"> | ||
<p>Lazy CSS: Must be red, but turn green when <button class="lazy-button">pressing this button</button>.</p> | ||
<p>But turn orange, when <button class="lazy-button2">pressing this button</button>. Additional clicks have no effect.</p> | ||
<p>Refresh and press buttons in reverse order: This should turn green instead.</p> | ||
</div> | ||
<div class="test preloaded-css1"> | ||
<p>Preloaded CSS: Must be green.</p> | ||
<p><button class="preloaded-button1">Pressing this button</button> displays an alert but has no styling effect.</p> | ||
</div> | ||
<div class="test preloaded-css2"> | ||
<p>Preloaded inlined CSS: Must be green.</p> | ||
<p><button class="preloaded-button2">Pressing this button</button> displays an alert but has no styling effect.</p> | ||
</div> | ||
<div class="errors"></div> | ||
<script async defer src="/dist/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import './initial.css'; | ||
|
||
const handleError = (err) => { | ||
document.querySelector(".errors").textContent += `\n${err.toString()}`; | ||
console.error(err); | ||
} | ||
|
||
const makeButton = (className, fn) => { | ||
const button = document.querySelector(className); | ||
button.addEventListener("click", () => { | ||
button.disabled = true; | ||
fn().then(() => { | ||
button.disabled = false; | ||
}).catch(handleError); | ||
}); | ||
} | ||
|
||
makeButton(".lazy-button", () => import('./lazy.js')); | ||
makeButton(".lazy-button2", () => import('./lazy2.css')); | ||
|
||
makeButton(".preloaded-button1", () => import(/* webpackChunkName: "preloaded1" */ './preloaded1')); | ||
makeButton(".preloaded-button2", () => import(/* webpackChunkName: "preloaded2" */ './preloaded2')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.initial-css { | ||
background: lightgreen; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.lazy-css { | ||
background: lightgreen; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './lazy.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.lazy-css { | ||
background: peru; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.preloaded-css1 { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import './preloaded1.css'; | ||
|
||
alert('Ok'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.preloaded-css2 { | ||
background: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import './preloaded2.css'; | ||
|
||
alert('Ok'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const Self = require('../../'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
output: { | ||
publicPath: '/dist/', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
Self.loader, | ||
'css-loader', | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new Self({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
devServer: { | ||
contentBase: __dirname, | ||
}, | ||
}; |
Oops, something went wrong.