Skip to content

Commit

Permalink
fix: move icon-sprite loading to demo/index.html so that it won't run…
Browse files Browse the repository at this point in the history
… during unit tests
  • Loading branch information
wyseguyonline committed Oct 26, 2017
1 parent 7701aa8 commit d7b0c0a
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 517 deletions.
493 changes: 0 additions & 493 deletions build/images/p-icons-sprite-1.1.svg

This file was deleted.

17 changes: 17 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@
overflow: auto;
}
</style>

<script>
if (!document.getElementById('pe-icons-sprite')) {
const pe_ajax=new XMLHttpRequest();
pe_ajax.open("GET", "/icons/p-icons-sprite-1.1.svg", true);
pe_ajax.responseType="document";
pe_ajax.onload=function() {
console.log('**** INSERTING ICON SPRITE ****');
console.log(pe_ajax);
document.body.insertBefore(
pe_ajax.responseXML.documentElement,
document.body.childNodes[0]
);
};
pe_ajax.send();
}
</script>
</head>
<body>
<!-- Customize the demo for your component -->
Expand Down
13 changes: 1 addition & 12 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,7 @@ export default class CoachMark {
}

init() {
if (!document.getElementById('pe-icons-sprite')) {
const pe_ajax=new XMLHttpRequest();
pe_ajax.open("GET", "/icons/p-icons-sprite-1.1.svg", true);
pe_ajax.responseType="document";
pe_ajax.onload=function() {
document.body.insertBefore(
pe_ajax.responseXML.documentElement,
document.body.childNodes[0]
);
};
pe_ajax.send();
}


ReactDOM.render(
<ComponentOwner
Expand Down
2 changes: 1 addition & 1 deletion npm_scripts/copyStuff.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ try {
}

try {
fs.copySync('./node_modules/pearson-elements/assets/icons/p-icons-sprite-1.1.svg', './build/images/p-icons-sprite-1.1.svg')
fs.copySync('./node_modules/pearson-elements/assets/icons/p-icons-sprite-1.1.svg', './build/icons/p-icons-sprite-1.1.svg')
} catch (err) {
console.error('copy icons error: ' + err)
}
Loading

0 comments on commit d7b0c0a

Please sign in to comment.