@@ -62,6 +62,29 @@ describe('PO Button Labs Sample', () => {
6262 } ) ;
6363 } ) ;
6464
65+ describe ( 'Alteração de Icon' , ( ) => {
66+ it ( 'deve aplicar o ícone an an-newspaper ao botão' , ( ) => {
67+ cy . get ( 'app-button-labs po-radio-group[name="icon"]' ) . contains ( 'an an-newspaper' ) . click ( ) ;
68+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'po-icon.po-button-icon' ) . should ( 'exist' ) ;
69+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'po-icon i.an-newspaper' ) . should ( 'exist' ) ;
70+ } ) ;
71+
72+ it ( 'deve aplicar o ícone an an-calendar-dots ao botão' , ( ) => {
73+ cy . get ( 'app-button-labs po-radio-group[name="icon"]' ) . contains ( 'an an-calendar-dots' ) . click ( ) ;
74+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'po-icon i.an-calendar-dots' ) . should ( 'exist' ) ;
75+ } ) ;
76+
77+ it ( 'deve aplicar o ícone an an-user ao botão' , ( ) => {
78+ cy . get ( 'app-button-labs po-radio-group[name="icon"]' ) . contains ( 'an an-user' ) . click ( ) ;
79+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'po-icon i.an-user' ) . should ( 'exist' ) ;
80+ } ) ;
81+
82+ it ( 'deve aplicar o ícone fa fa-podcast ao botão' , ( ) => {
83+ cy . get ( 'app-button-labs po-radio-group[name="icon"]' ) . contains ( 'fa fa-podcast' ) . click ( ) ;
84+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'po-icon i.fa-podcast' ) . should ( 'exist' ) ;
85+ } ) ;
86+ } ) ;
87+
6588 describe ( 'Alteração de Kind' , ( ) => {
6689 it ( 'deve alterar o kind para primary' , ( ) => {
6790 cy . get ( 'app-button-labs po-radio-group[name="kind"]' ) . contains ( 'primary' ) . click ( ) ;
@@ -74,11 +97,46 @@ describe('PO Button Labs Sample', () => {
7497 } ) ;
7598 } ) ;
7699
100+ describe ( 'Alteração de Type' , ( ) => {
101+ it ( 'deve alterar o type para submit' , ( ) => {
102+ cy . get ( 'app-button-labs po-radio-group[name="type"]' ) . contains ( 'submit' ) . click ( ) ;
103+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'button.po-button' ) . should ( 'have.attr' , 'type' , 'submit' ) ;
104+ } ) ;
105+
106+ it ( 'deve alterar o type para reset' , ( ) => {
107+ cy . get ( 'app-button-labs po-radio-group[name="type"]' ) . contains ( 'reset' ) . click ( ) ;
108+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'button.po-button' ) . should ( 'have.attr' , 'type' , 'reset' ) ;
109+ } ) ;
110+ } ) ;
111+
77112 describe ( 'Alteração de Size' , ( ) => {
78113 it ( 'deve alterar o tamanho para large' , ( ) => {
79114 cy . get ( 'app-button-labs po-radio-group[name="size"]' ) . contains ( 'large' ) . click ( ) ;
80115 cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'button.po-button' ) . should ( 'have.class' , 'po-button-large' ) ;
81116 } ) ;
117+
118+ it ( 'deve alterar o tamanho de large para medium' , ( ) => {
119+ // Muda para large primeiro
120+ cy . get ( 'app-button-labs po-radio-group[name="size"]' ) . contains ( 'large' ) . click ( ) ;
121+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'button.po-button' ) . should ( 'have.class' , 'po-button-large' ) ;
122+
123+ // Volta para medium
124+ cy . get ( 'app-button-labs po-radio-group[name="size"]' ) . contains ( 'medium' ) . click ( ) ;
125+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'button.po-button' ) . should ( 'not.have.class' , 'po-button-large' ) ;
126+ } ) ;
127+ } ) ;
128+
129+ describe ( 'Interação Danger e Kind Tertiary' , ( ) => {
130+ it ( 'deve desabilitar a opção Danger ao selecionar kind tertiary' , ( ) => {
131+ cy . get ( 'app-button-labs po-radio-group[name="kind"]' ) . contains ( 'tertiary' ) . click ( ) ;
132+ // Quando kind é tertiary, a opção Danger fica desabilitada
133+ cy . get ( 'app-button-labs po-checkbox-group po-checkbox' ) . last ( ) . find ( 'span.po-checkbox' ) . should ( 'have.attr' , 'aria-disabled' , 'true' ) ;
134+ } ) ;
135+
136+ it ( 'deve desabilitar a opção tertiary ao marcar Danger' , ( ) => {
137+ cy . get ( 'app-button-labs po-checkbox-group' ) . contains ( 'Danger' ) . click ( ) ;
138+ cy . get ( 'app-button-labs po-radio-group[name="kind"]' ) . find ( 'po-radio' ) . last ( ) . find ( 'input' ) . should ( 'be.disabled' ) ;
139+ } ) ;
82140 } ) ;
83141
84142 describe ( 'Botão Click' , ( ) => {
@@ -90,16 +148,22 @@ describe('PO Button Labs Sample', () => {
90148 } ) ;
91149
92150 describe ( 'Restore' , ( ) => {
93- it ( 'deve restaurar o estado inicial ao clicar em Sample Restore' , ( ) => {
94- // Altera o label
151+ it ( 'deve restaurar o estado inicial completo ao clicar em Sample Restore' , ( ) => {
152+ // Altera várias propriedades
95153 cy . get ( 'app-button-labs po-input input' ) . clear ( ) . type ( 'Teste' ) ;
96- cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( '.po-button-label' ) . should ( 'contain.text' , 'Teste' ) ;
154+ cy . get ( 'app-button-labs po-radio-group[name="kind"]' ) . contains ( 'primary' ) . click ( ) ;
155+ cy . get ( 'app-button-labs po-radio-group[name="size"]' ) . contains ( 'large' ) . click ( ) ;
156+ cy . get ( 'app-button-labs po-radio-group[name="icon"]' ) . contains ( 'an an-user' ) . click ( ) ;
157+ cy . get ( 'app-button-labs po-checkbox-group' ) . contains ( 'Disabled' ) . click ( ) ;
97158
98159 // Clica em restaurar
99160 cy . get ( 'app-button-labs po-button' ) . last ( ) . find ( 'button.po-button' ) . click ( ) ;
100161
101- // Verifica que o kind voltou para secondary
162+ // Verifica que tudo voltou ao estado inicial
102163 cy . get ( 'app-button-labs po-button' ) . first ( ) . should ( 'have.attr' , 'p-kind' , 'secondary' ) ;
164+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'button.po-button' ) . should ( 'not.be.disabled' ) ;
165+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'button.po-button' ) . should ( 'not.have.class' , 'po-button-large' ) ;
166+ cy . get ( 'app-button-labs po-button' ) . first ( ) . find ( 'po-icon' ) . should ( 'not.exist' ) ;
103167 } ) ;
104168 } ) ;
105169} ) ;
0 commit comments