Commit e42169c2 authored by Phil Hughes's avatar Phil Hughes

Updates SSH key title after pasting key

Previously it was listening for focusout, it now listens for blur &
paste events

Closes #28436
parent d6f18f8e
Pipeline #6712428 passed with stages
in 74 minutes and 15 seconds
......@@ -84,13 +84,14 @@
}
$(function() {
$(document).on('focusout.ssh_key', '#key_key', function() {
$(document).on('input.ssh_key', '#key_key', function() {
const $title = $('#key_title');
const comment = $(this).val().match(/^\S+ \S+ (.+)\n?$/);
if (comment && comment.length > 1 && $title.val() === '') {
// Extract the SSH Key title from its comment
if (comment && comment.length > 1) {
return $title.val(comment[1]).change();
}
// Extract the SSH Key title from its comment
});
if (global.utils.getPagePath() === 'profiles') {
return new Profile();
......
---
title: SSH key field updates title after pasting key
merge_request:
author:
......@@ -15,7 +15,7 @@ feature 'Profile > SSH Keys', feature: true do
scenario 'auto-populates the title', js: true do
fill_in('Key', with: attributes_for(:key).fetch(:key))
expect(find_field('Title').value).to eq 'dummy@gitlab.com'
expect(page).to have_field("Title", with: "dummy@gitlab.com")
end
scenario 'saves the new key' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment