mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
ignore button attr as button color
This commit is contained in:
@@ -144,8 +144,8 @@ export class Button {
|
||||
this._setClass(this._icon, assignCssClass); // button-icon-left
|
||||
|
||||
let colorStyle = (this._style && this._style !== 'solid' ? this._style + '-' : '');
|
||||
this._colors.forEach(color => {
|
||||
this._setClass(colorStyle + color, assignCssClass); // button-secondary
|
||||
this._colors.forEach(colorName => {
|
||||
this._setClass(colorStyle + colorName, assignCssClass); // button-secondary, button-clear-secondary
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ const BUTTON_SIZE_ATTRS = ['large', 'small'];
|
||||
const BUTTON_STYLE_ATTRS = ['clear', 'outline', 'solid'];
|
||||
const BUTTON_SHAPE_ATTRS = ['round', 'fab'];
|
||||
const BUTTON_DISPLAY_ATTRS = ['block', 'full'];
|
||||
const IGNORE_ATTRS = /_ng/;
|
||||
const IGNORE_ATTRS = /_ng|button/;
|
||||
|
||||
const TEXT = 1;
|
||||
const ICON = 2;
|
||||
|
||||
@@ -24,9 +24,17 @@ export function run() {
|
||||
return button.elementRef.nativeElement.classList.contains(className);
|
||||
}
|
||||
|
||||
it('should ignore certain attributes', () => {
|
||||
let b = mockButton(['_ngcontent', 'button']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button')).toEqual(true);
|
||||
expect(hasClass(b, 'button-_ngcontent')).toEqual(false);
|
||||
expect(hasClass(b, 'button-button')).toEqual(false);
|
||||
});
|
||||
|
||||
it('should set a different button role', () => {
|
||||
let b = mockButton(['outline', 'small', 'full', 'primary']);
|
||||
b.setRole('bar-button')
|
||||
b.setRole('bar-button');
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'bar-button-outline')).toEqual(true);
|
||||
expect(hasClass(b, 'bar-button-small')).toEqual(true);
|
||||
|
||||
Reference in New Issue
Block a user