Commit b92897b5 authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[AboutPage] Use dom-if for release notes instead of hidden

Changes the release notes online and offline elements to render with a
dom-if instead of with hidden. This makes it easier to deep link to
either of the elements.

Bug: 1084154
Change-Id: I1e062524cfbfb616e960141e404230fb3d85a2e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402131
Commit-Queue: Daniel Classon <dclasson@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805816}
parent a5d4660b
...@@ -154,13 +154,15 @@ ...@@ -154,13 +154,15 @@
</a> </a>
</div> </div>
</cr-link-row> </cr-link-row>
<template is="dom-if" if="[[hasReleaseNotes_]]"> <template is="dom-if" if="[[showReleaseNotesOnline_(hasReleaseNotes_,
hasInternetConnection_)]]">
<cr-link-row class="hr" id="releaseNotesOnline" <cr-link-row class="hr" id="releaseNotesOnline"
hidden="[[!hasInternetConnection_]]"
on-click="onReleaseNotesTap_" on-click="onReleaseNotesTap_"
label="$i18n{aboutShowReleaseNotes}" external></cr-link-row> label="$i18n{aboutShowReleaseNotes}" external></cr-link-row>
</template>
<template is="dom-if" if="[[showReleaseNotesOffline_(hasReleaseNotes_,
hasInternetConnection_)]]">
<cr-link-row class="hr" id="releaseNotesOffline" <cr-link-row class="hr" id="releaseNotesOffline"
hidden="[[hasInternetConnection_]]"
on-click="onReleaseNotesTap_" on-click="onReleaseNotesTap_"
label="$i18n{aboutShowReleaseNotes}" label="$i18n{aboutShowReleaseNotes}"
title="$i18n{aboutReleaseNotesOffline}" external></cr-link-row> title="$i18n{aboutReleaseNotesOffline}" external></cr-link-row>
......
...@@ -316,6 +316,23 @@ Polymer({ ...@@ -316,6 +316,23 @@ Polymer({
return this.currentUpdateStatusEvent_.status == UpdateStatus.FAILED; return this.currentUpdateStatusEvent_.status == UpdateStatus.FAILED;
}, },
/**
* @return {boolean}
* @private
*/
showReleaseNotesOnline_() {
return this.hasReleaseNotes_ && this.hasInternetConnection_;
},
/**
* @return {boolean}
* @private
*/
showReleaseNotesOffline_() {
return this.hasReleaseNotes_ && !this.hasInternetConnection_;
},
/** /**
* @return {string} * @return {string}
* @private * @private
......
...@@ -300,8 +300,7 @@ cr.define('settings_about_page', function() { ...@@ -300,8 +300,7 @@ cr.define('settings_about_page', function() {
async function checkReleaseNotesOnline(isShowing) { async function checkReleaseNotesOnline(isShowing) {
await aboutBrowserProxy.whenCalled('getEnabledReleaseNotes'); await aboutBrowserProxy.whenCalled('getEnabledReleaseNotes');
const releaseNotesOnlineEl = page.$$('#releaseNotesOnline'); const releaseNotesOnlineEl = page.$$('#releaseNotesOnline');
assertTrue(!!releaseNotesOnlineEl); assertEquals(isShowing, !!releaseNotesOnlineEl);
assertEquals(isShowing, !releaseNotesOnlineEl.hidden);
} }
/** /**
...@@ -313,8 +312,7 @@ cr.define('settings_about_page', function() { ...@@ -313,8 +312,7 @@ cr.define('settings_about_page', function() {
async function checkReleaseNotesOffline(isShowing) { async function checkReleaseNotesOffline(isShowing) {
await aboutBrowserProxy.whenCalled('getEnabledReleaseNotes'); await aboutBrowserProxy.whenCalled('getEnabledReleaseNotes');
const releaseNotesOfflineEl = page.$$('#releaseNotesOffline'); const releaseNotesOfflineEl = page.$$('#releaseNotesOffline');
assertTrue(!!releaseNotesOfflineEl); assertEquals(isShowing, !!releaseNotesOfflineEl);
assertEquals(isShowing, !releaseNotesOfflineEl.hidden);
} }
/** /**
...@@ -324,9 +322,9 @@ cr.define('settings_about_page', function() { ...@@ -324,9 +322,9 @@ cr.define('settings_about_page', function() {
async function checkReleaseNotesDisabled() { async function checkReleaseNotesDisabled() {
await aboutBrowserProxy.whenCalled('getEnabledReleaseNotes'); await aboutBrowserProxy.whenCalled('getEnabledReleaseNotes');
const releaseNotesOnlineEl = page.$$('#releaseNotesOnline'); const releaseNotesOnlineEl = page.$$('#releaseNotesOnline');
assertTrue(!releaseNotesOnlineEl); assertFalse(!!releaseNotesOnlineEl);
const releaseNotesOfflineEl = page.$$('#releaseNotesOffline'); const releaseNotesOfflineEl = page.$$('#releaseNotesOffline');
assertTrue(!releaseNotesOfflineEl); assertFalse(!!releaseNotesOfflineEl);
} }
aboutBrowserProxy.setReleaseNotes(false); aboutBrowserProxy.setReleaseNotes(false);
......
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