Skip to content

Commit

Permalink
Fix deletion of urls (#11338)
Browse files Browse the repository at this point in the history
  • Loading branch information
spylogsster authored Nov 30, 2021
1 parent 250517b commit 2966283
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
spellcheck="false"
on-input=urlChangedRpc_
value="{{item.value}}"
class="mandatory"
autofocus>
</cr-input>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Polymer({
},
updateSubmitButtonState_: function() {
for (const input of this.shadowRoot.querySelectorAll('.mandatory')) {
if (input && (input.invalid || !input.value || input.value.trim() === '')) {
if (input && (input.invalid || !input.value || (input.value.trim && input.value.trim() === ''))) {
this.isSubmitButtonEnabled_ = false
return;
}
Expand All @@ -202,8 +202,7 @@ Polymer({
this.isSubmitButtonEnabled_ = false
return;
}

if (!this.rpcUrls.find(element => element.value !== '')) {
if (!this.hasValidRPCUrls()) {
this.isSubmitButtonEnabled_ = false
return;
}
Expand All @@ -221,14 +220,17 @@ Polymer({
this.updateSubmitButtonState_()
const empty = element.value.trim() === ''
if (list == 'rpc' && element.invalid) {
const text = empty ? this.i18n('walletAddNetworkMandarotyFieldError')
const text = empty && !this.hasValidRPCUrls() ? this.i18n('walletAddNetworkMandarotyFieldError')
: this.i18n('walletAddNetworkInvalidURLInput')
element.setAttribute('error-message', text)
}
if (!element.invalid || empty) {
this.updatePlusButtonState(list)
}
},
hasValidRPCUrls: function() {
return this.rpcUrls.find(element => this.validateURL(element.value))
},
urlChangedIcons_: function(event) {
return this.urlChangedImpl_(event.target, 'icon')
},
Expand Down

0 comments on commit 2966283

Please sign in to comment.