Skip to content

Commit c80b094

Browse files
committed
refactor: tweaks
1 parent d610ce9 commit c80b094

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

dev-server/src/index.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,9 @@ ReactDom.render(
183183

184184
{/* String with special escape sequences */}
185185
<JsonViewer
186-
collapsed
186+
theme='monokai'
187187
name='String with special escape sequences'
188188
src={getExampleWithStringEscapeSequences()}
189-
onEdit={e => {
190-
console.log('edit callback', e)
191-
if (e.new_value == 'error') {
192-
return false
193-
}
194-
}}
195189
/>
196190
</div>,
197191
document.getElementById('app-container')
@@ -202,7 +196,7 @@ ReactDom.render(
202196
/*-------------------------------------------------------------------------*/
203197

204198
//just a function to get an example JSON object
205-
function getExampleJson1() {
199+
function getExampleJson1 () {
206200
return {
207201
string: 'this is a test string',
208202
integer: 42,
@@ -231,7 +225,7 @@ function getExampleJson1() {
231225
}
232226

233227
//and another a function to get an example JSON object
234-
function getExampleJson2() {
228+
function getExampleJson2 () {
235229
return {
236230
normalized: {
237231
'1-grams': {
@@ -269,7 +263,7 @@ function getExampleJson2() {
269263
}
270264
}
271265

272-
function getExampleJson3() {
266+
function getExampleJson3 () {
273267
return {
274268
example_information:
275269
'this example has the collapsed prop set to true and the indentWidth prop is set to 8',
@@ -285,7 +279,7 @@ function getExampleJson3() {
285279
}
286280
}
287281

288-
function getExampleJson4() {
282+
function getExampleJson4 () {
289283
const large_array = new Array(225).fill('this is a large array full of items')
290284

291285
large_array.push(getExampleArray())
@@ -295,7 +289,7 @@ function getExampleJson4() {
295289
return large_array
296290
}
297291

298-
function getExampleArray() {
292+
function getExampleArray () {
299293
return [
300294
'you can also display arrays!',
301295
new Date(),
@@ -308,6 +302,6 @@ function getExampleArray() {
308302
]
309303
}
310304

311-
function getExampleWithStringEscapeSequences() {
305+
function getExampleWithStringEscapeSequences () {
312306
return { '\\\n\t\r\f\\n': '\\\n\t\r\f\\n' }
313307
}

test/tests/js/components/DataTypes/String-test.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import JsonString from './../../../../../src/js/components/DataTypes/String'
66

77
describe('<JsonString />', function () {
88
it('string component should have a data type label', function () {
9-
const rjvId = 1
109
const wrapper = mount(
1110
<JsonString
1211
value='test'
13-
rjvId={rjvId}
1412
displayDataTypes
1513
theme='rjv-default'
1614
/>
@@ -19,10 +17,8 @@ describe('<JsonString />', function () {
1917
})
2018

2119
it('string with hidden data type', function () {
22-
const rjvId = 1
2320
const props = {
2421
value: 'test',
25-
rjvId: 1,
2622
theme: 'rjv-default',
2723
displayDataTypes: false
2824
}
@@ -32,10 +28,8 @@ describe('<JsonString />', function () {
3228

3329
// test collapsed string and expand click
3430
it('string displaying data type', function () {
35-
const rjvId = 1
3631
const props = {
3732
value: 'test',
38-
rjvId: 1,
3933
displayDataTypes: false,
4034
theme: 'rjv-default'
4135
}
@@ -44,11 +38,9 @@ describe('<JsonString />', function () {
4438
})
4539

4640
it('collapsed string content', function () {
47-
const rjvId = 1
4841
const props = {
4942
value: '123456789',
5043
collapseStringsAfterLength: 3,
51-
rjvId: 1,
5244
displayDataTypes: false,
5345
theme: 'rjv-default'
5446
}
@@ -63,10 +55,8 @@ describe('<JsonString />', function () {
6355
})
6456

6557
it('string with special escape sequences', function () {
66-
const rjvId = 1
6758
const props = {
6859
value: '\\\n\t\r\f\\n',
69-
rjvId: 1,
7060
displayDataTypes: false,
7161
theme: 'rjv-default'
7262
}

0 commit comments

Comments
 (0)