This repository was archived by the owner on Nov 28, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +57
-6
lines changed Expand file tree Collapse file tree 3 files changed +57
-6
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,58 @@ const body = `
36
36
` ;
37
37
38
38
test ( 'should output only left content if `isThreeColumn=left`' , ( ) => {
39
- const content = mount ( < Content body = { body } isThreeColumn = ' left' /> ) ;
39
+ const content = mount ( < Content body = { body } isThreeColumn = " left" /> ) ;
40
40
41
41
expect ( content . find ( '.magic-block-textarea' ) . length ) . toBe ( 1 ) ;
42
42
} ) ;
43
43
44
44
test ( 'should output only right content if `isThreeColumn=right`' , ( ) => {
45
- const content = mount ( < Content body = { body } isThreeColumn = ' right' /> ) ;
45
+ const content = mount ( < Content body = { body } isThreeColumn = " right" /> ) ;
46
46
47
47
expect ( content . find ( '.magic-block-api-header' ) . length ) . toBe ( 1 ) ;
48
48
} ) ;
49
+
50
+ test ( 'should make code not-dark if it is in the left column' , ( ) => {
51
+ const content = mount (
52
+ < Content
53
+ body = { `
54
+ [block:code]
55
+ {
56
+ "codes": [
57
+ {
58
+ "code": "var a = 1;",
59
+ "language": "javascript"
60
+ }
61
+ ]
62
+ }
63
+ [/block]
64
+ ` }
65
+ isThreeColumn = "left"
66
+ /> ,
67
+ ) ;
68
+
69
+ expect ( content . html ( ) ) . toContain ( 'cm-s-neo' ) ;
70
+ } ) ;
71
+
72
+ test ( 'should make code `dark` if it is in right column' , ( ) => {
73
+ const content = mount (
74
+ < Content
75
+ body = { `
76
+ [block:code]
77
+ {
78
+ "codes": [
79
+ {
80
+ "code": "var a = 1;",
81
+ "language": "javascript"
82
+ }
83
+ ],
84
+ "sidebar": true
85
+ }
86
+ [/block]
87
+ ` }
88
+ isThreeColumn = "right"
89
+ /> ,
90
+ ) ;
91
+
92
+ expect ( content . html ( ) ) . toContain ( 'cm-s-tomorrow-night' ) ;
93
+ } ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class BlockCode extends React.Component {
15
15
this . setState ( { activeTab : i } ) ;
16
16
}
17
17
render ( ) {
18
- const { block, opts = { } } = this . props ;
18
+ const { block, opts = { } , dark } = this . props ;
19
19
const codes = Array . isArray ( block . data . codes ) ? block . data . codes : [ ] ;
20
20
21
21
return (
@@ -64,7 +64,7 @@ class BlockCode extends React.Component {
64
64
< code
65
65
// eslint-disable-next-line
66
66
dangerouslySetInnerHTML = { {
67
- __html : syntaxHighlighter ( code . code , code . language , opts . dark ) ,
67
+ __html : syntaxHighlighter ( code . code , code . language , dark ) ,
68
68
} }
69
69
/>
70
70
}
Original file line number Diff line number Diff line change @@ -78,7 +78,13 @@ const Content = props => {
78
78
) ;
79
79
}
80
80
81
- return < Loop content = { isThreeColumn === 'left' ? left : right } flags = { props . flags } /> ;
81
+ return (
82
+ < Loop
83
+ content = { isThreeColumn === 'left' ? left : right }
84
+ flags = { props . flags }
85
+ column = { isThreeColumn }
86
+ />
87
+ ) ;
82
88
} ;
83
89
84
90
Loop . propTypes = {
@@ -97,7 +103,7 @@ Loop.defaultProps = {
97
103
} ;
98
104
99
105
Content . propTypes = {
100
- isThreeColumn : PropTypes . oneOfType ( [ PropTypes . bool , PropTypes . string ] ) ,
106
+ isThreeColumn : PropTypes . oneOfType ( [ PropTypes . bool , PropTypes . string ] ) ,
101
107
body : PropTypes . string ,
102
108
flags : PropTypes . shape ( { } ) ,
103
109
} ;
You can’t perform that action at this time.
0 commit comments