Genericize "Contact Us" page

Parameterize integration, support and announcement email addresses and contact
phone number, make static parameters flow through the system in a consistent
manner.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136183813
This commit is contained in:
mmuller 2016-10-14 12:16:23 -07:00 committed by Ben McIlwain
parent 6a4088a8b6
commit 84bbb9a7c0
16 changed files with 177 additions and 65 deletions

View file

@ -53,7 +53,11 @@ function setUp() {
clientId: test.testClientId,
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Nomulus'
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
});
registry.registrar.ConsoleTestUtil.setup(test);
var regNavlist = $('reg-navlist');
@ -91,8 +95,8 @@ function testEppLogin() {
registry.registrar.ConsoleTestUtil.visit(
test, {
isEppLoggedIn: true,
testClientId: test.testClientId,
testXsrfToken: test.testXsrfToken,
clientId: test.testClientId,
xsrfToken: test.testXsrfToken,
productName: 'Foo Registry'
}, function() {
test.sessionMock.login(
@ -122,7 +126,7 @@ function testShowLoginOrDash() {
function testNavToResources() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'resources',
testXsrfToken: test.testXsrfToken
xsrfToken: test.testXsrfToken
});
var xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue(xhr.isActive());
@ -143,7 +147,12 @@ function testNavToResources() {
function testNavToContactUs() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'contact-us',
testXsrfToken: test.testXsrfToken
xsrfToken: test.testXsrfToken,
productName: 'Domain Registry',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
});
var xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue(xhr.isActive());

View file

@ -59,8 +59,8 @@ registry.registrar.ConsoleTestUtil.visit = function(
test, opt_args, opt_moar) {
opt_args = opt_args || {};
opt_args.path = opt_args.path || '';
opt_args.testClientId = opt_args.testClientId || 'dummyRegistrarId';
opt_args.testXsrfToken = opt_args.testXsrfToken || 'dummyXsrfToken';
opt_args.clientId = opt_args.clientId || 'dummyRegistrarId';
opt_args.xsrfToken = opt_args.xsrfToken || 'dummyXsrfToken';
if (opt_args.isEppLoggedIn === undefined) {
opt_args.isEppLoggedIn = true;
}
@ -69,7 +69,7 @@ registry.registrar.ConsoleTestUtil.visit = function(
test.historyMock.getToken().$returns(opt_args.path).$anyTimes();
test.sessionMock.isEppLoggedIn().$returns(opt_args.isEppLoggedIn).$anyTimes();
test.sessionMock.getClientId().$returns(opt_args.isEppLoggedIn ?
opt_args.testClientId : null).$anyTimes();
opt_args.clientId : null).$anyTimes();
if (opt_args.rspXml) {
test.sessionMock
.send(goog.testing.mockmatchers.isString,
@ -86,10 +86,7 @@ registry.registrar.ConsoleTestUtil.visit = function(
}
test.mockControl.$replayAll();
/** @type {!registry.registrar.Console} */
test.console = new registry.registrar.Console(
opt_args.testXsrfToken,
opt_args.testClientId,
opt_args.productName);
test.console = new registry.registrar.Console(opt_args);
// XXX: Should be triggered via event passing.
test.console.handleHashChange();
test.mockControl.$verifyAll();

View file

@ -52,7 +52,11 @@ function setUp() {
clientId: test.testClientId,
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Nomulus'
productName: 'Nomulus',
integrationEmail: 'integration@google.com',
supportEmail: 'support@google.com',
announcementsEmail: 'announcements@google.com',
supportPhoneNumber: '123 456 7890',
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);
@ -70,8 +74,8 @@ function tearDown() {
function testCollectionView() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'contact-settings',
testXsrfToken: test.testXsrfToken,
testClientId: test.testClientId
xsrfToken: test.testXsrfToken,
clientId: test.testClientId
});
registry.testing.assertReqMockRsp(
test.testXsrfToken,
@ -93,8 +97,8 @@ function testCollectionView() {
function testItemView() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'contact-settings/test@example.com',
testXsrfToken: test.testXsrfToken,
testClientId: test.testClientId
xsrfToken: test.testXsrfToken,
clientId: test.testClientId
});
registry.testing.assertReqMockRsp(
test.testXsrfToken,
@ -196,7 +200,7 @@ function testChangeContactTypes() {
function testOneOfManyUpdate() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'contact-settings/test@example.com',
testXsrfToken: test.testXsrfToken,
xsrfToken: test.testXsrfToken,
testClientId: test.testClientId
});
var testContacts = [
@ -243,7 +247,7 @@ function testOneOfManyUpdate() {
function testDelete() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'contact-settings/test@example.com',
testXsrfToken: test.testXsrfToken,
xsrfToken: test.testXsrfToken,
testClientId: test.testClientId
});
var testContacts = [

View file

@ -43,7 +43,11 @@ function setUp() {
clientId: 'daddy',
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Nomulus'
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
});
registry.registrar.ConsoleTestUtil.setup(test);
}

View file

@ -49,7 +49,11 @@ function setUp() {
clientId: 'ignore',
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Nomulus'
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
@ -59,7 +63,10 @@ function setUp() {
historyMock.setEnabled(true);
mocks.$replayAll();
registrarConsole = new registry.registrar.Console('☢', 'jartine');
registrarConsole = new registry.registrar.Console({
xsrfToken: '☢',
clientId: 'jartine'
});
mocks.$verifyAll();
}

View file

@ -49,7 +49,11 @@ function setUp() {
clientId: 'ignore',
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Nomulus'
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
@ -59,7 +63,10 @@ function setUp() {
historyMock.setEnabled(true);
mocks.$replayAll();
registrarConsole = new registry.registrar.Console('☢', 'jartine');
registrarConsole = new registry.registrar.Console({
xsrfToken: '☢',
clientId: 'jartine'
});
mocks.$verifyAll();
}

View file

@ -57,7 +57,11 @@ function setUp() {
clientId: test.testClientId,
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Nomulus'
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);
@ -75,7 +79,7 @@ function tearDown() {
function testView() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'security-settings',
testXsrfToken: test.testXsrfToken,
xsrfToken: test.testXsrfToken,
testClientId: test.testClientId
});
registry.testing.assertReqMockRsp(

View file

@ -51,7 +51,11 @@ function setUp() {
clientId: test.testClientId,
showPaymentLink: false,
logoFilename: 'logo.png',
productName: 'Nomulus'
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test);
@ -93,7 +97,7 @@ function createTestRegistrar() {
function testView() {
registry.registrar.ConsoleTestUtil.visit(test, {
path: 'whois-settings',
testXsrfToken: test.testXsrfToken,
xsrfToken: test.testXsrfToken,
testClientId: test.testClientId
});
var testRegistrar = createTestRegistrar();