-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Apply text-disabled to labels and hint blocks when components are disabled #194
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@crowdstrike/ember-toucan-core': patch | ||
'@crowdstrike/ember-toucan-form': patch | ||
--- | ||
|
||
Updates disabled styling for all form components to set the `text-disabled` class on the label and hint elements. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<div | ||
class="type-xs-tight text-body-and-labels mt-0.5" | ||
class="type-xs-tight mt-0.5 | ||
{{if @isDisabled 'text-disabled' 'text-body-and-labels'}}" | ||
...attributes | ||
>{{yield}}</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
<label class="type-md-tight text-body-and-labels block" ...attributes> | ||
<label | ||
class="type-md-tight block | ||
{{if @isDisabled 'text-disabled' 'text-body-and-labels'}}" | ||
...attributes | ||
> | ||
{{yield}} | ||
</label> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ module('Integration | Component | Fields | CheckboxField', function (hooks) { | |
</template>); | ||
|
||
assert.dom('[data-label]').hasText('Label'); | ||
assert.dom('[data-label]').hasClass('text-titles-and-attributes'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've got mixed feelings on asserting class names in tests, as I'd prefer visual regression testing instead; however, I want to make sure we don't regress until we get something like Percy added. Note 2: Radio and checkbox labels use |
||
|
||
assert | ||
.dom('[data-hint]') | ||
|
@@ -122,6 +123,8 @@ module('Integration | Component | Fields | CheckboxField', function (hooks) { | |
assert.dom('[data-checkbox]').isDisabled(); | ||
|
||
assert.dom('[data-lock-icon]').exists(); | ||
|
||
assert.dom('[data-label]').hasClass('text-disabled'); | ||
}); | ||
|
||
test('it sets readonly on the checkbox using `@isReadOnly` and renders a lock icon', async function (assert) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,8 @@ module('Integration | Component | Fields | FileInput', function (hooks) { | |
</template>); | ||
|
||
assert.dom('[data-label]').hasText('Label'); | ||
assert.dom('label').hasClass('text-body-and-labels'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FileInput is a bit different than the others, where because of the markup, |
||
|
||
assert.dom('[data-trigger]').hasText('Select Files'); | ||
|
||
assert | ||
|
@@ -192,6 +194,8 @@ module('Integration | Component | Fields | FileInput', function (hooks) { | |
assert.dom('[data-file-input-field]').hasClass('text-disabled'); | ||
|
||
assert.dom('[data-lock-icon]').exists(); | ||
|
||
assert.dom('label').hasClass('text-disabled'); | ||
}); | ||
|
||
test('it sets readonly on the input using `@isReadOnly` and renders a lock icon', async function (assert) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be tempting to make a
GroupLegend
component or something, that's essentiallyLabel
but renders a<legend
and can be used here and with the radio-group; however, I punted on this for now. Happy to do it in a follow up if folks think it'd be worth it though.