Diff
checker
Texto
Texto
Imagens
Documentos
Excel
Pastas
Legal
Enterprise
Aplicativo para desktop
Preços
Fazer login
Baixar o Diffchecker Desktop
Comparar texto
Encontre a diferença entre dois arquivos de texto
Ferramentas
Histórico
Editor live
Ocultar espaços em branco
Recolher inalteradas
Sem quebra de linha
Layout
Dividido
Unificado
Nível de detalhe
Inteligente
Palavra
Caractere
Estilos de texto
Alterar aparência
Realce de sintaxe
Escolher sintaxe
Ignorar
Transformar texto
Ir à primeira mudança
Editar entrada
Diffchecker Desktop
A maneira mais segura de usar o Diffchecker. Obtenha o aplicativo Diffchecker Desktop: seus diffs nunca saem do seu computador!
Obter Desktop
Untitled diff
Criado
há 7 anos
O diff nunca expira
Limpar
Exportar
Compartilhar
Explicar
0 remoções
Linhas
Total
Removido
Caracteres
Total
Removido
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
74 linhas
Copiar tudo
7 adições
Linhas
Total
Adicionado
Caracteres
Total
Adicionado
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
74 linhas
Copiar tudo
/**
/**
* @format
* @format
* @jest-environment jsdom
* @jest-environment jsdom
*/
*/
/**
/**
* External dependencies
* External dependencies
*/
*/
import { shallow } from 'enzyme';
import { shallow } from 'enzyme';
import React from 'react';
import React from 'react';
import { identity, noop } from 'lodash';
import { identity, noop } from 'lodash';
/**
/**
* Internal dependencies
* Internal dependencies
*/
*/
Copiar
Copiado
Copiar
Copiado
import { CreditCardFormFields
} from '../';
import { CreditCardFormFields
UX
} from '../';
import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific';
import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific';
jest.mock( 'i18n-calypso', () => ( {
jest.mock( 'i18n-calypso', () => ( {
localize: x => x,
localize: x => x,
} ) );
} ) );
jest.mock( 'lib/checkout/processor-specific', () => {
jest.mock( 'lib/checkout/processor-specific', () => {
return {
return {
shouldRenderAdditionalCountryFields: jest.fn( false ),
shouldRenderAdditionalCountryFields: jest.fn( false ),
};
};
} );
} );
// Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.'
// Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.'
jest.mock( 'lib/user', () => () => {} );
jest.mock( 'lib/user', () => () => {} );
const defaultProps = {
const defaultProps = {
card: {},
card: {},
countriesList: [],
countriesList: [],
eventFormName: 'A fine form',
eventFormName: 'A fine form',
translate: identity,
translate: identity,
isFieldInvalid: identity,
isFieldInvalid: identity,
onFieldChange: noop,
onFieldChange: noop,
isNewTransaction: true,
isNewTransaction: true,
};
};
Copiar
Copiado
Copiar
Copiado
describe( 'CreditCardFormFields
', () => {
describe( 'CreditCardFormFields
UX
', () => {
test( 'should have `CreditCardFormFields
` class', () => {
test( 'should have `CreditCardFormFields
UX
` class', () => {
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 );
expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 );
} );
} );
test( 'should not render ebanx fields', () => {
test( 'should not render ebanx fields', () => {
Copiar
Copiado
Copiar
Copiado
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
} );
} );
describe( 'with ebanx activated', () => {
describe( 'with ebanx activated', () => {
beforeAll( () => {
beforeAll( () => {
shouldRenderAdditionalCountryFields.mockReturnValue( true );
shouldRenderAdditionalCountryFields.mockReturnValue( true );
} );
} );
afterAll( () => {
afterAll( () => {
shouldRenderAdditionalCountryFields.mockReturnValue( false );
shouldRenderAdditionalCountryFields.mockReturnValue( false );
} );
} );
test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => {
test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => {
Copiar
Copiado
Copiar
Copiado
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
wrapper.setProps( { card: { country: 'BR' } } );
wrapper.setProps( { card: { country: 'BR' } } );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 );
} );
} );
test( 'should not display Ebanx fields when there is a transaction in process', () => {
test( 'should not display Ebanx fields when there is a transaction in process', () => {
Copiar
Copiado
Copiar
Copiado
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } );
wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
} );
} );
} );
} );
} );
} );
Diferenças salvas
Texto original
Abrir arquivo
/** * @format * @jest-environment jsdom */ /** * External dependencies */ import { shallow } from 'enzyme'; import React from 'react'; import { identity, noop } from 'lodash'; /** * Internal dependencies */ import { CreditCardFormFields } from '../'; import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific'; jest.mock( 'i18n-calypso', () => ( { localize: x => x, } ) ); jest.mock( 'lib/checkout/processor-specific', () => { return { shouldRenderAdditionalCountryFields: jest.fn( false ), }; } ); // Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.' jest.mock( 'lib/user', () => () => {} ); const defaultProps = { card: {}, countriesList: [], eventFormName: 'A fine form', translate: identity, isFieldInvalid: identity, onFieldChange: noop, isNewTransaction: true, }; describe( 'CreditCardFormFields', () => { test( 'should have `CreditCardFormFields` class', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 ); } ); test( 'should not render ebanx fields', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); describe( 'with ebanx activated', () => { beforeAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( true ); } ); afterAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( false ); } ); test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' } } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 ); } ); test( 'should not display Ebanx fields when there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); } ); } );
Texto alterado
Abrir arquivo
/** * @format * @jest-environment jsdom */ /** * External dependencies */ import { shallow } from 'enzyme'; import React from 'react'; import { identity, noop } from 'lodash'; /** * Internal dependencies */ import { CreditCardFormFieldsUX } from '../'; import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific'; jest.mock( 'i18n-calypso', () => ( { localize: x => x, } ) ); jest.mock( 'lib/checkout/processor-specific', () => { return { shouldRenderAdditionalCountryFields: jest.fn( false ), }; } ); // Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.' jest.mock( 'lib/user', () => () => {} ); const defaultProps = { card: {}, countriesList: [], eventFormName: 'A fine form', translate: identity, isFieldInvalid: identity, onFieldChange: noop, isNewTransaction: true, }; describe( 'CreditCardFormFieldsUX', () => { test( 'should have `CreditCardFormFieldsUX` class', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 ); } ); test( 'should not render ebanx fields', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); describe( 'with ebanx activated', () => { beforeAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( true ); } ); afterAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( false ); } ); test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' } } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 ); } ); test( 'should not display Ebanx fields when there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); } ); } );
Encontrar Diferença