Skip to content

Commit

Permalink
Revert "Styles are added to the snapshot as valid HTML in the <style>…
Browse files Browse the repository at this point in the history
… element. (#149)" (#151)

This reverts commit 9c519dd.
  • Loading branch information
MicheleBertoli authored Jun 26, 2018
1 parent 9c519dd commit 57c488d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 64 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ When we rerun the test, the output is different: the style rules are included in
- Snapshot
+ Received

+<style>
+.c0 {
+ color: green;
+}
+</style>
+
<button
- className="sc-bdVaJa rOCEJ"
Expand All @@ -136,11 +134,9 @@ This is the resulting snapshot:

```js
exports[`it works 1`] = `
<style>
.c0 {
color: green;
}
</style>
<button
className="c0"
Expand All @@ -166,7 +162,6 @@ Thanks to Jest Styled Components, Jest is now able to provide the exact informat
- color: green;
+ color: blue;
}
</style>

<button
className="c0"
Expand Down
7 changes: 2 additions & 5 deletions src/styleSheetSerializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ const getNodes = (node, nodes = []) => {
return nodes
}

const markNodes = nodes =>
nodes.forEach(node => {
node[KEY] = true
})
const markNodes = nodes => nodes.forEach(node => (node[KEY] = true))

const getClassNames = nodes =>
nodes.reduce((classNames, node) => {
Expand Down Expand Up @@ -107,7 +104,7 @@ const styleSheetSerializer = {
const style = getStyle(classNames)
const code = print(val)

let result = style ? `<style>\n${style}\n</style>\n\n${code}` : code
let result = `${style}${style ? '\n\n' : ''}${code}`
result = replaceClassNames(result, classNames, style)
result = replaceHashes(result, hashes)

Expand Down
Loading

0 comments on commit 57c488d

Please sign in to comment.