mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
set button colors with style types
This commit is contained in:
@@ -31,7 +31,7 @@ export function run() {
|
||||
expect(hasClass(b, 'bar-button-outline')).toEqual(true);
|
||||
expect(hasClass(b, 'bar-button-small')).toEqual(true);
|
||||
expect(hasClass(b, 'bar-button-full')).toEqual(true);
|
||||
expect(hasClass(b, 'bar-button-primary')).toEqual(true);
|
||||
expect(hasClass(b, 'bar-button-outline-primary')).toEqual(true);
|
||||
|
||||
expect(hasClass(b, 'button-outline')).toEqual(false);
|
||||
expect(hasClass(b, 'button-small')).toEqual(false);
|
||||
@@ -45,13 +45,37 @@ export function run() {
|
||||
expect(hasClass(b, 'button-outline')).toEqual(true);
|
||||
expect(hasClass(b, 'button-small')).toEqual(true);
|
||||
expect(hasClass(b, 'button-full')).toEqual(true);
|
||||
expect(hasClass(b, 'button-primary')).toEqual(true);
|
||||
expect(hasClass(b, 'button-outline-primary')).toEqual(true);
|
||||
|
||||
b._assignCss(false);
|
||||
expect(hasClass(b, 'button-outline')).toEqual(false);
|
||||
expect(hasClass(b, 'button-small')).toEqual(false);
|
||||
expect(hasClass(b, 'button-full')).toEqual(false);
|
||||
expect(hasClass(b, 'button-primary')).toEqual(false);
|
||||
expect(hasClass(b, 'button-outline-primary')).toEqual(false);
|
||||
});
|
||||
|
||||
it('should read button color attributes with styles', () => {
|
||||
let b = mockButton(['outline', 'small', 'full', 'primary']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button')).toEqual(true);
|
||||
expect(hasClass(b, 'button-outline')).toEqual(true);
|
||||
expect(hasClass(b, 'button-small')).toEqual(true);
|
||||
expect(hasClass(b, 'button-full')).toEqual(true);
|
||||
expect(hasClass(b, 'button-outline-primary')).toEqual(true);
|
||||
|
||||
b = mockButton(['clear', 'primary', 'secondary']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button')).toEqual(true);
|
||||
expect(hasClass(b, 'button-clear')).toEqual(true);
|
||||
expect(hasClass(b, 'button-clear-primary')).toEqual(true);
|
||||
expect(hasClass(b, 'button-clear-secondary')).toEqual(true);
|
||||
|
||||
b = mockButton(['solid', 'primary', 'secondary']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button')).toEqual(true);
|
||||
expect(hasClass(b, 'button-solid')).toEqual(true);
|
||||
expect(hasClass(b, 'button-primary')).toEqual(true);
|
||||
expect(hasClass(b, 'button-secondary')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should read button color attributes', () => {
|
||||
@@ -63,21 +87,10 @@ export function run() {
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-primary')).toEqual(true);
|
||||
expect(hasClass(b, 'button-secondary')).toEqual(true);
|
||||
|
||||
b = mockButton(['outline', 'small', 'full', 'primary']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-outline')).toEqual(true);
|
||||
expect(hasClass(b, 'button-small')).toEqual(true);
|
||||
expect(hasClass(b, 'button-full')).toEqual(true);
|
||||
expect(hasClass(b, 'button-primary')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should read button style attributes', () => {
|
||||
let b = mockButton(['round']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-round')).toEqual(true);
|
||||
|
||||
b = mockButton(['clear']);
|
||||
let b = mockButton(['clear']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-clear')).toEqual(true);
|
||||
|
||||
@@ -85,10 +98,6 @@ export function run() {
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-outline')).toEqual(true);
|
||||
|
||||
b = mockButton(['fab']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-fab')).toEqual(true);
|
||||
|
||||
b = mockButton(['clear', 'outline', 'small', 'full']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-clear')).toEqual(false);
|
||||
@@ -97,6 +106,16 @@ export function run() {
|
||||
expect(hasClass(b, 'button-full')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should read button shape attributes', () => {
|
||||
let b = mockButton(['round']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-round')).toEqual(true);
|
||||
|
||||
b = mockButton(['fab']);
|
||||
b._assignCss(true);
|
||||
expect(hasClass(b, 'button-fab')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should read button display attributes', () => {
|
||||
let b = mockButton(['block']);
|
||||
b._assignCss(true);
|
||||
|
||||
Reference in New Issue
Block a user