-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a "trim" button to the value editor toolbar
- Ticket: AUT-2038
- Loading branch information
Showing
6 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/renderer/components/secret-editor/value-editor/trim-button/trim-button.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<e-tooltip content="Trim" class="trim"> | ||
<div | ||
class="e-btn e-btn-small e-btn-onlyicon e-btn-borderless" | ||
@click="trim()" | ||
> | ||
<e-icon icon="e-cut" size="small"></e-icon> | ||
</div> | ||
</e-tooltip> |
12 changes: 12 additions & 0 deletions
12
src/renderer/components/secret-editor/value-editor/trim-button/trim-button.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default { | ||
name: 'trim-button', | ||
template: require('./trim-button.html'), | ||
props: { | ||
text: { type: String, default: '' } | ||
}, | ||
methods: { | ||
trim() { | ||
this.$emit('trim', this.text.trim()); | ||
} | ||
} | ||
}; |
19 changes: 19 additions & 0 deletions
19
src/renderer/components/secret-editor/value-editor/trim-button/trim-button.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import JsonFormatButton from './trim-button'; | ||
|
||
describe('TrimButton', () => { | ||
describe('#trim', () => { | ||
it('should trim the given text', () => { | ||
const wrapper = mount(JsonFormatButton, { | ||
propsData: { | ||
text: ' Gummi Bears ' | ||
} | ||
}); | ||
|
||
wrapper.find('.e-btn').trigger('click'); | ||
|
||
const emitted = wrapper.emitted().trim[0][0]; | ||
expect(emitted).to.eql('Gummi Bears'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters