Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

add 'description' for object setting #1045

Merged
merged 1 commit into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/settings-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,11 @@ function elementForObject (namespace, name, value) {
h3.textContent = getSettingTitle(keyPath, name)
section.appendChild(h3)

const descriptionDiv = document.createElement('div')
descriptionDiv.classList.add('setting-description')
descriptionDiv.innerHTML = getSettingDescription(keyPath)
section.appendChild(descriptionDiv);

const div = document.createElement('div')
div.classList.add('sub-section-body')
for (const key of sortSettings(keyPath, value)) {
Expand Down
8 changes: 8 additions & 0 deletions spec/settings-panel-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ describe "SettingsPanel", ->
barGroup:
type: 'object'
title: 'Bar group'
description: 'description of bar group'
properties:
bar:
title: 'Bar'
Expand Down Expand Up @@ -215,6 +216,13 @@ describe "SettingsPanel", ->
# Should be already collapsed
expect(controlGroups[1].querySelector('.sub-section .sub-section-heading').parentElement.classList.contains('collapsed')).toBe true

it 'ensures grouped settings can have a description', ->
expect(settingsPanel.element.querySelectorAll('.section-container > .section-body')).toHaveLength 1
controlGroups = settingsPanel.element.querySelectorAll('.section-body > .control-group')
expect(controlGroups).toHaveLength 3
expect(controlGroups[0].querySelectorAll('.sub-section > .setting-description')).toHaveLength 1
expect(controlGroups[0].querySelector('.sub-section > .setting-description').textContent).toBe 'description of bar group'

describe 'settings validation', ->
beforeEach ->
config =
Expand Down