Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMPASS-395: Wrap strings inputs in quotes #660

Merged
merged 2 commits into from
Dec 3, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ class EditableDocument extends React.Component {
editing={this.state.editing} />
));
}
components.push(<Hotspot key="hotspot" element={this.doc} />);
if (this.state.editing) {
components.push(<Hotspot key="document-hotspot" element={this.doc} />);
}
return components;
}

Expand Down
31 changes: 20 additions & 11 deletions src/internal-packages/crud/lib/component/editable-value.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,24 +192,33 @@ class EditableValue extends React.Component {
return `${VALUE_CLASS} ${typeClass}`;
}

/**
* Get the style for the input wrapper.
*/
wrapperStyle() {
return `${VALUE_CLASS}-wrapper-is-${this.element.currentType.toLowerCase()}`;
}

/**
* Render a single editable value.
*
* @returns {React.Component} The element component.
*/
render() {
return (
<input
ref={(c) => this._node = c}
type="text"
size={inputSize(this.element.currentValue, this.element.currentType)}
className={this.style()}
onBlur={this.handleBlur.bind(this)}
onFocus={this.handleFocus.bind(this)}
onChange={this.handleChange.bind(this)}
onKeyDown={this.handleKeyDown.bind(this)}
onPaste={this.handlePaste.bind(this)}
value={this.getValue()} />
<span className={this.wrapperStyle()}>
<input
ref={(c) => this._node = c}
type="text"
size={inputSize(this.element.currentValue, this.element.currentType)}
className={this.style()}
onBlur={this.handleBlur.bind(this)}
onFocus={this.handleFocus.bind(this)}
onChange={this.handleChange.bind(this)}
onKeyDown={this.handleKeyDown.bind(this)}
onPaste={this.handlePaste.bind(this)}
value={this.getValue()} />
</span>
);
}
}
Expand Down
29 changes: 13 additions & 16 deletions src/internal-packages/crud/styles/editable-element-value.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@
padding-left: 1px;

&-is-string {
color: steelblue;
white-space: pre-line;
word-break: break-all;
&::before {
content: "\"";
}
&::after {
content: "\"";
}
padding-right: 0px;
}

&-is-int32 {
Expand Down Expand Up @@ -50,15 +44,6 @@
}
}

&-is-code {
&::before {
content: "Code('";
}
&::after {
content: "')";
}
}

&-is-editing {
box-shadow: 2px 5px 8px rgba(0,0,0,0.2);
border: 1px solid @gray3;
Expand All @@ -67,4 +52,16 @@
margin-top: -1px;
margin-bottom: -1px;
}

&-wrapper {
&-is-string {
color: steelblue;
&::before {
content: "\"";
}
&::after {
content: "\"";
}
}
}
}
9 changes: 0 additions & 9 deletions src/internal-packages/crud/styles/element.less
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,5 @@
content: "')";
}
}

&-is-code {
&::before {
content: "Code('";
}
&::after {
content: "')";
}
}
}
}
2 changes: 1 addition & 1 deletion test/support/spectron-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function addClickCommands(client) {
const base = selector('close-privacy-settings-button');
return this
.click(base)
.waitForVisible(base, true)
.waitForVisible(base, TIMEOUT, true)
.waitUntil(function() {
return this.getText('div[data-hook=optin-container]').then(function(text) {
return text.length === 0;
Expand Down