Skip to content

Commit 24d29d0

Browse files
authored
Merge pull request jdorn#781 from tohosaku/theme_options
Enable theme options
2 parents 426aa63 + 7b73d35 commit 24d29d0

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

README_ADDON.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,11 @@ window.JSONEditor.defaults.callbacks.cleave = {
464464

465465

466466

467-
#Themes
467+
# Themes
468468

469469
Themes have own options for changing various aspects of the display.
470470

471-
##Bootstrap 4
471+
## Bootstrap 4
472472

473473
| Option | Default | Description
474474
| ------------- | ------ | -----
@@ -481,7 +481,7 @@ Themes have own options for changing various aspects of the display.
481481
| `table_zebrastyle` | `false` | Add "zebra style" to array "table" rows
482482
| `tooltip` | `bootstrap` | how to display tooltips (infoText). Can be `browser` for native `[title]`, `css` for simple CSS Styling, or `bootstrap` for TWBS/Popper.js handling
483483

484-
##Spectre
484+
## Spectre
485485

486486
| Option | Default | Description
487487
| ------------- | ------ | -----
@@ -493,7 +493,7 @@ Themes have own options for changing various aspects of the display.
493493
| `table_border` | `false` | Add border to array "table" row and cells
494494
| `table_zebrastyle` | `false` | Add "zebra style" to array "table" rows
495495

496-
##Tailwind
496+
## Tailwind
497497

498498
| Option | Default | Description
499499
| ------------- | ------ | -----
@@ -506,4 +506,3 @@ Themes have own options for changing various aspects of the display.
506506
| `table_border` | `false` | Add border to array "table" row and cells
507507
| `table_hdiv` | `false` | Add bottom-border to array "table" cells
508508
| `table_zebrastyle` | `false` | Add "zebra style" to array "table" rows
509-

src/theme.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ const matchKey = [
88
export class AbstractTheme {
99
constructor (jsoneditor, options = { disable_theme_rules: false }) {
1010
this.jsoneditor = jsoneditor
11-
11+
Object.keys(options).forEach(key => {
12+
if (typeof jsoneditor.options[key] !== 'undefined') {
13+
options[key] = jsoneditor.options[key]
14+
}
15+
})
1216
/* Theme config options that allows changing various aspects of the output */
1317
this.options = options
1418
}

tests/codeceptjs/themes_test.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ Scenario('It should display button Labels: spectre | null', async (I) => {
4343
I.waitForText('Delete All')
4444
I.waitForText('Move down')
4545
I.waitForText('Move up')
46+
I.seeElement('.table-striped') // can see when theme options is enabled
47+
I.seeElement('.je-table-border') // can see when theme options is enabled
48+
I.dontSeeElement('.je-noindent') // can't see when theme options is enabled
4649
})
4750

4851
/*
@@ -76,7 +79,8 @@ Scenario('It should display button Labels: jqueryui | null', async (I) => {
7679
})
7780
*/
7881

79-
/*Scenario('It should display button Labels: foundation6 | null', async (I) => {
82+
/*
83+
Scenario('It should display button Labels: foundation6 | null', async (I) => {
8084
I.amOnPage('themes.html')
8185
I.selectOption('theme', 'Foundation 6')
8286
I.waitForText('Themes Test Page')

tests/pages/themes.html

+4
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@
471471
remove_button_labels: true,
472472
theme: theme,
473473
iconlib: iconlib,
474+
object_indent: true,
475+
object_border: true,
476+
table_zebrastyle: true,
477+
table_border: true
474478
});
475479
}
476480

0 commit comments

Comments
 (0)