From 16cec7d93d04048947f64c14e40c46ce9cd337d1 Mon Sep 17 00:00:00 2001 From: Suzanne Aitchison Date: Wed, 7 Jul 2021 09:41:35 +0100 Subject: [PATCH] [15 min fix] Add aria-current attribute to current dashboard link (#14128) * add aria-current attribute to current dashboard link * Update app/views/dashboards/_actions.html.erb Co-authored-by: rhymes * Update app/views/dashboards/_actions.html.erb Co-authored-by: rhymes * Update app/views/dashboards/_actions.html.erb Co-authored-by: rhymes * Update app/views/dashboards/_actions.html.erb Co-authored-by: rhymes * Update app/views/dashboards/_actions.html.erb Co-authored-by: rhymes * Update app/views/dashboards/_actions.html.erb Co-authored-by: rhymes * stub network request * fix typo in stub * always guard against lack of entries Co-authored-by: rhymes --- .../javascripts/initializers/initScrolling.js | 6 +- app/views/dashboards/_actions.html.erb | 30 ++-- .../dashboardNavigation.spec.js | 134 ++++++++++++++++++ 3 files changed, 160 insertions(+), 10 deletions(-) create mode 100644 cypress/integration/dashboardFlows/dashboardNavigation.spec.js diff --git a/app/assets/javascripts/initializers/initScrolling.js b/app/assets/javascripts/initializers/initScrolling.js index b330bc698..c70dbf0cd 100644 --- a/app/assets/javascripts/initializers/initScrolling.js +++ b/app/assets/javascripts/initializers/initScrolling.js @@ -43,7 +43,7 @@ function fetchNext(el, endpoint, insertCallback) { } function insertNext(params, buildCallback) { - return function insertEntries(entries) { + return function insertEntries(entries = []) { var list = document.getElementById(params.listId || 'sublist'); var newFollowersHTML = ''; entries.forEach(function insertAnEntry(entry) { @@ -57,7 +57,9 @@ function insertNext(params, buildCallback) { }); var followList = document.getElementById('following-wrapper'); - followList.insertAdjacentHTML('beforeend', newFollowersHTML); + if (followList) { + followList.insertAdjacentHTML('beforeend', newFollowersHTML); + } if (nextPage > 0) { fetching = false; } diff --git a/app/views/dashboards/_actions.html.erb b/app/views/dashboards/_actions.html.erb index ec1a00d19..40a770a77 100644 --- a/app/views/dashboards/_actions.html.erb +++ b/app/views/dashboards/_actions.html.erb @@ -1,35 +1,49 @@ -