Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface DnsRequirementsNoticeProps {
}

export const DnsRequirementsNotice = ( { domainName, domainData }: DnsRequirementsNoticeProps ) => {
if ( ! domainData.has_wpcom_nameservers ) {
if ( domainData.has_wpcom_nameservers ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems logical. @zaguiini can verify.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferring this to @Automattic/quake

return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* @jest-environment jsdom
*/
import { DomainSubtype } from '@automattic/api-core';
import { screen } from '@testing-library/react';
import { render } from '../../../test-utils';
import { DnsRequirementsNotice } from '../dns-requirements-notice';
import type { Domain } from '@automattic/api-core';

function makeDomainData( overrides: Partial< Domain > ): Domain {
return {
has_wpcom_nameservers: true,
subtype: { id: DomainSubtype.DOMAIN_REGISTRATION, label: 'Domain Registration' },
...overrides,
} as Domain;
}

describe( '<DnsRequirementsNotice>', () => {
// DOTEMP-76
test( 'shows the DNS requirements notice when using external name servers', () => {
render(
<DnsRequirementsNotice
domainName="example.com"
domainData={ makeDomainData( { has_wpcom_nameservers: false } ) }
/>
);

expect( screen.getByText( /your domain is using external name servers/i ) ).toBeVisible();
} );

// DOTEMP-76
test( 'hides the DNS requirements notice when using WordPress.com name servers', () => {
render(
<DnsRequirementsNotice
domainName="example.com"
domainData={ makeDomainData( { has_wpcom_nameservers: true } ) }
/>
);

expect(
screen.queryByText( /your domain is using external name servers/i )
).not.toBeInTheDocument();
} );

// DOTEMP-76
test( 'shows a domain connection variant notice when using external name servers on a connected domain', () => {
render(
<DnsRequirementsNotice
domainName="example.com"
domainData={ makeDomainData( {
has_wpcom_nameservers: false,
subtype: { id: DomainSubtype.DOMAIN_CONNECTION, label: 'Domain Connection' },
} ) }
/>
);

expect( screen.getByText( /your domain is using external name servers/i ) ).toBeVisible();
} );
} );
Loading