From 0031c8cf4142f835686259fecfa9e0ac16aa802d Mon Sep 17 00:00:00 2001 From: Kapunahele Wong Date: Fri, 2 Apr 2021 15:30:22 -0400 Subject: [PATCH] docs: improve accessibility of attribute-binding example (#41432) PR Close #41432 --- .../attribute-binding/e2e/src/app.e2e-spec.ts | 10 ++--- .../src/app/app.component.css | 38 ++++++++++++------- .../src/app/app.component.html | 26 ++++++++----- .../src/app/app.component.ts | 5 ++- .../app/comp-with-host-binding.component.ts | 3 +- ...nput-with-attribute-decorator.component.ts | 2 +- 6 files changed, 50 insertions(+), 34 deletions(-) diff --git a/aio/content/examples/attribute-binding/e2e/src/app.e2e-spec.ts b/aio/content/examples/attribute-binding/e2e/src/app.e2e-spec.ts index cf08ae5bba..539cf65fc4 100644 --- a/aio/content/examples/attribute-binding/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/attribute-binding/e2e/src/app.e2e-spec.ts @@ -13,17 +13,17 @@ describe('Attribute binding example', () => { }); it('should display an Aria button', async () => { - expect(await element.all(by.css('button')).get(0).getText()).toBe('Go for it with Aria'); + expect(await element.all(by.css('button')).get(0).getText()).toBe('Create and set an attribute with Aria'); }); - it('should display a blue background on div', async () => { + it('should display a black background on div', async () => { const div = element.all(by.css('div')).get(1); - expect(await div.getCssValue('background-color')).toEqual('rgba(25, 118, 210, 1)'); + expect(await div.getCssValue('background-color')).toEqual('rgba(0, 0, 0, 1)'); }); - it('should display a blue div with a red border', async () => { + it('should display a black div with a light blue double border', async () => { const div = element.all(by.css('div')).get(1); - expect(await div.getCssValue('border')).toEqual('2px solid rgb(212, 30, 46)'); + expect(await div.getCssValue('border')).toEqual('16px double rgb(87, 209, 255)'); }); it('should display a div with many classes', async () => { diff --git a/aio/content/examples/attribute-binding/src/app/app.component.css b/aio/content/examples/attribute-binding/src/app/app.component.css index f26e6c8569..b3ad1d6079 100644 --- a/aio/content/examples/attribute-binding/src/app/app.component.css +++ b/aio/content/examples/attribute-binding/src/app/app.component.css @@ -1,22 +1,32 @@ .special { - background-color: #1976d2; + background-color: black; color: #ffffff; + margin-bottom: .5rem; + padding: 1rem; } -.item { - font-weight: bold; -} .clearance { - border: 2px solid #d41e2e; - -} -.item-clearance { - font-style: italic; - + border: 1rem double #57d1ff; } -.new-class { - background-color: #ed1b2f; - font-style: italic; - color: #fff; +/* Styles for demo */ + +comp-with-host-binding { + display: block; + margin: 1rem 0; +} + +td { + padding: 1rem; + text-align: center; +} + +h3 { + padding: 1rem 0 .75rem 0; +} + +.readability { + background-color: black; + padding: .5rem; + margin: 1rem 0; } diff --git a/aio/content/examples/attribute-binding/src/app/app.component.html b/aio/content/examples/attribute-binding/src/app/app.component.html index 1f8c2ede6b..3016451db4 100644 --- a/aio/content/examples/attribute-binding/src/app/app.component.html +++ b/aio/content/examples/attribute-binding/src/app/app.component.html @@ -35,19 +35,22 @@
Some text.
- -
Some text.
+ +
Some text.

Source specificity

-Some text. + + + -Some text. - +
+ +

Dynamic vs static

@@ -55,15 +58,18 @@
Some text.
- -
Some text.
+ +
Some text.
- - - +
+ + + +
+ diff --git a/aio/content/examples/attribute-binding/src/app/app.component.ts b/aio/content/examples/attribute-binding/src/app/app.component.ts index 57c9f28718..6d64302183 100644 --- a/aio/content/examples/attribute-binding/src/app/app.component.ts +++ b/aio/content/examples/attribute-binding/src/app/app.component.ts @@ -6,10 +6,11 @@ import { Component } from '@angular/core'; styleUrls: ['./app.component.css'] }) export class AppComponent { - actionName = 'Go for it'; + actionName = 'Create and set an attribute'; isSpecial = true; canSave = true; classExpression = 'special clearance'; - styleExpression = 'color: red'; + styleExpression = 'border: solid red 3px'; color = 'blue'; + border = '.5rem dashed black'; } diff --git a/aio/content/examples/attribute-binding/src/app/comp-with-host-binding.component.ts b/aio/content/examples/attribute-binding/src/app/comp-with-host-binding.component.ts index b604e44454..0c7ebed81c 100644 --- a/aio/content/examples/attribute-binding/src/app/comp-with-host-binding.component.ts +++ b/aio/content/examples/attribute-binding/src/app/comp-with-host-binding.component.ts @@ -9,11 +9,10 @@ export class CompWithHostBindingComponent { isSpecial = false; @HostBinding('style.color') - color = 'green'; + color = 'pink'; // #docregion hostbinding @HostBinding('style.width') width = '200px'; // #enddocregion hostbinding - } diff --git a/aio/content/examples/attribute-binding/src/app/my-input-with-attribute-decorator.component.ts b/aio/content/examples/attribute-binding/src/app/my-input-with-attribute-decorator.component.ts index 9a08650168..e2c83f70d1 100644 --- a/aio/content/examples/attribute-binding/src/app/my-input-with-attribute-decorator.component.ts +++ b/aio/content/examples/attribute-binding/src/app/my-input-with-attribute-decorator.component.ts @@ -2,7 +2,7 @@ import { Attribute, Component } from '@angular/core'; @Component({ selector: 'app-my-input-with-attribute-decorator', - template: 'The type of the input is: {{ type }}' + template: '

The type of the input is: {{ type }}

' }) export class MyInputWithAttributeDecoratorComponent { constructor(@Attribute('type') public type: string) { }