ui: 1.16.x Back to HCP link conditions (#19443)
Only show back to hcp link if CONSUL_HCP_URL is present
This commit is contained in:
parent
6eca67fa81
commit
9860f68703
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
ui: only show hcp link if url is present
|
||||
```
|
|
@ -3,6 +3,7 @@
|
|||
SPDX-License-Identifier: MPL-2.0
|
||||
}}
|
||||
|
||||
{{#if (env 'CONSUL_HCP_URL')}}
|
||||
<div
|
||||
class="consul-hcp-home"
|
||||
...attributes
|
||||
|
@ -11,3 +12,4 @@
|
|||
Back to HCP
|
||||
</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -40,4 +40,34 @@ module('Integration | Component | consul hcp home', function(hooks) {
|
|||
assert.dom('a').hasAttribute('href', 'http://hcp');
|
||||
|
||||
});
|
||||
|
||||
test('it does not output the Back to HCP link if CONSUL_HCP_URL is not present', async function(assert) {
|
||||
// temporary registration until we are running as separate applications
|
||||
this.owner.register(
|
||||
'component:consul/hcp/home',
|
||||
ConsulHcpHome
|
||||
);
|
||||
//
|
||||
|
||||
const Helper = this.owner.resolveRegistration('helper:env');
|
||||
this.owner.register(
|
||||
'helper:env',
|
||||
class extends Helper {
|
||||
compute([name, def]) {
|
||||
switch(name) {
|
||||
case 'CONSUL_HCP_URL':
|
||||
return undefined;
|
||||
}
|
||||
return super.compute(...arguments);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
await render(hbs`
|
||||
<Consul::Hcp::Home />
|
||||
`);
|
||||
|
||||
assert.dom('[data-test-back-to-hcp]').doesNotExist();
|
||||
assert.dom('a').doesNotExist();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue