Wrap render of console.main soy in a utility function

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=216695490
This commit is contained in:
guyben 2018-10-11 07:51:36 -07:00 committed by Ben McIlwain
parent 9e02502fd4
commit 3bb525349f
9 changed files with 125 additions and 187 deletions

View file

@ -13,6 +13,7 @@ closure_js_library(
deps = [ deps = [
"//java/google/registry/ui/js", "//java/google/registry/ui/js",
"//java/google/registry/ui/js/registrar", "//java/google/registry/ui/js/registrar",
"//java/google/registry/ui/soy/registrar",
"@io_bazel_rules_closure//closure/library", "@io_bazel_rules_closure//closure/library",
"@io_bazel_rules_closure//closure/library:testing", "@io_bazel_rules_closure//closure/library:testing",
], ],
@ -28,7 +29,6 @@ closure_js_test(
":console_test_util", ":console_test_util",
"//java/google/registry/ui/js", "//java/google/registry/ui/js",
"//java/google/registry/ui/js/registrar", "//java/google/registry/ui/js/registrar",
"//java/google/registry/ui/soy/registrar",
"//javatests/google/registry/ui/js:testing", "//javatests/google/registry/ui/js:testing",
"@io_bazel_rules_closure//closure/library", "@io_bazel_rules_closure//closure/library",
"@io_bazel_rules_closure//closure/library:testing", "@io_bazel_rules_closure//closure/library:testing",

View file

@ -17,7 +17,6 @@ goog.setTestOnly();
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.dom.classlist'); goog.require('goog.dom.classlist');
goog.require('goog.json'); goog.require('goog.json');
goog.require('goog.soy');
goog.require('goog.testing.MockControl'); goog.require('goog.testing.MockControl');
goog.require('goog.testing.PropertyReplacer'); goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts'); goog.require('goog.testing.asserts');
@ -25,15 +24,14 @@ goog.require('goog.testing.jsunit');
goog.require('goog.testing.mockmatchers'); goog.require('goog.testing.mockmatchers');
goog.require('goog.testing.net.XhrIo'); goog.require('goog.testing.net.XhrIo');
goog.require('registry.registrar.ConsoleTestUtil'); goog.require('registry.registrar.ConsoleTestUtil');
goog.require('registry.soy.registrar.console');
goog.require('registry.testing'); goog.require('registry.testing');
goog.require('registry.util'); goog.require('registry.util');
var $ = goog.dom.getRequiredElement; const $ = goog.dom.getRequiredElement;
var stubs = new goog.testing.PropertyReplacer(); const stubs = new goog.testing.PropertyReplacer();
var test = { const test = {
testXsrfToken: 'testToken', testXsrfToken: 'testToken',
testClientId: 'daddy', testClientId: 'daddy',
mockControl: new goog.testing.MockControl() mockControl: new goog.testing.MockControl()
@ -44,24 +42,13 @@ function setUp() {
registry.testing.addToDocument('<div id="test"/>'); registry.testing.addToDocument('<div id="test"/>');
registry.testing.addToDocument('<div class="kd-butterbar"/>'); registry.testing.addToDocument('<div class="kd-butterbar"/>');
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo); stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
var testElt = goog.dom.getElement('test'); registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
goog.soy.renderElement(testElt, registry.soy.registrar.console.main, {
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
username: 'blah',
logoutUrl: 'omg',
isAdmin: true,
clientId: test.testClientId, clientId: test.testClientId,
logoFilename: 'logo.png',
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs',
}); });
registry.registrar.ConsoleTestUtil.setup(test); registry.registrar.ConsoleTestUtil.setup(test);
var regNavlist = $('reg-navlist'); const regNavlist = $('reg-navlist');
var active = regNavlist.querySelector('a[href="#contact-us"]'); const active = regNavlist.querySelector('a[href="#contact-us"]');
assertTrue(active != null); assertTrue(active != null);
} }
@ -78,7 +65,7 @@ function testButter() {
productName: 'Foo Registry' productName: 'Foo Registry'
}); });
registry.util.butter('butter msg'); registry.util.butter('butter msg');
var butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar')); const butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar'));
assertNotNull(butter.innerHTML.match(/.*butter msg.*/)); assertNotNull(butter.innerHTML.match(/.*butter msg.*/));
assertTrue(goog.dom.classlist.contains(butter, goog.getCssName('shown'))); assertTrue(goog.dom.classlist.contains(butter, goog.getCssName('shown')));
} }
@ -131,7 +118,7 @@ function testNavToResources() {
premiumPriceAckRequired: false, premiumPriceAckRequired: false,
readonly: true, readonly: true,
}); });
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue(xhr.isActive()); assertTrue(xhr.isActive());
assertEquals('/registrar-settings', xhr.getLastUri()); assertEquals('/registrar-settings', xhr.getLastUri());
assertEquals(test.testXsrfToken, assertEquals(test.testXsrfToken,
@ -157,12 +144,12 @@ function testNavToContactUs() {
announcementsEmail: 'announcement@example.com', announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123' supportPhoneNumber: '+1 (888) 555 0123'
}); });
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue(xhr.isActive()); assertTrue(xhr.isActive());
assertEquals('/registrar-settings', xhr.getLastUri()); assertEquals('/registrar-settings', xhr.getLastUri());
assertEquals(test.testXsrfToken, assertEquals(test.testXsrfToken,
xhr.getLastRequestHeaders()['X-CSRF-Token']); xhr.getLastRequestHeaders()['X-CSRF-Token']);
var passcode = '5-5-5-5-5'; const passcode = '5-5-5-5-5';
xhr.simulateResponse(200, goog.json.serialize({ xhr.simulateResponse(200, goog.json.serialize({
status: 'SUCCESS', status: 'SUCCESS',
message: 'OK', message: 'OK',

View file

@ -18,9 +18,11 @@ goog.setTestOnly('registry.registrar.ConsoleTestUtil');
goog.require('goog.History'); goog.require('goog.History');
goog.require('goog.asserts'); goog.require('goog.asserts');
goog.require('goog.dom.xml'); goog.require('goog.dom.xml');
goog.require('goog.soy');
goog.require('goog.testing.mockmatchers'); goog.require('goog.testing.mockmatchers');
goog.require('registry.registrar.Console'); goog.require('registry.registrar.Console');
goog.require('registry.registrar.EppSession'); goog.require('registry.registrar.EppSession');
goog.require('registry.soy.registrar.console');
goog.require('registry.xml'); goog.require('registry.xml');
@ -28,7 +30,7 @@ goog.require('registry.xml');
* Utility method that attaches mocks to a `TestCase`. This was * Utility method that attaches mocks to a `TestCase`. This was
* originally in the ctor for ConsoleTest and should simply be * originally in the ctor for ConsoleTest and should simply be
* inherited but jstd_test breaks inheritance in test cases. * inherited but jstd_test breaks inheritance in test cases.
* @param {Object} test the test case to configure. * @param {!Object} test the test case to configure.
*/ */
registry.registrar.ConsoleTestUtil.setup = function(test) { registry.registrar.ConsoleTestUtil.setup = function(test) {
test.historyMock = test.mockControl.createLooseMock(goog.History, true); test.historyMock = test.mockControl.createLooseMock(goog.History, true);
@ -42,13 +44,41 @@ registry.registrar.ConsoleTestUtil.setup = function(test) {
.$returns(test.sessionMock); .$returns(test.sessionMock);
}; };
/**
* Utility method that renders the registry.soy.registrar.console.main element.
*
* This element has a lot of parameters. We use defaults everywhere, but you can
* override them with 'opt_args'.
*
* @param {!Element} element the element whose content we are rendering into.
* @param {?Object=} opt_args override for the default values of the soy params.
*/
registry.registrar.ConsoleTestUtil.renderConsoleMain = function(
element, opt_args) {
const args = opt_args || {};
goog.soy.renderElement(element, registry.soy.registrar.console.main, {
xsrfToken: args.xsrfToken || 'ignore',
username: args.username || 'jart',
logoutUrl: args.logoutUrl || 'https://logout.url.com',
isAdmin: goog.isDefAndNotNull(args.isAdmin) ? args.isAdmin : true,
clientId: args.clientId || 'ignore',
logoFilename: args.logoFilename || 'logo.png',
productName: args.productName || 'Nomulus',
integrationEmail: args.integrationEmail || 'integration@example.com',
supportEmail: args.supportEmail || 'support@example.com',
announcementsEmail: args.announcementsEmail || 'announcement@example.com',
supportPhoneNumber: args.supportPhoneNumber || '+1 (888) 555 0123',
technicalDocsUrl: args.technicalDocsUrl || 'http://example.com/techdocs',
});
};
/** /**
* Simulates visiting a page on the console. Sets path, then mocks * Simulates visiting a page on the console. Sets path, then mocks
* session and calls `handleHashChange_`. * session and calls `handleHashChange_`.
* @param {Object} test the test case to configure. * @param {!Object} test the test case to configure.
* @param {Object=} opt_args may include path, isEppLoggedIn. * @param {?Object=} opt_args may include path, isEppLoggedIn.
* @param {Function=} opt_moar extra setup after called just before * @param {?Function=} opt_moar extra setup after called just before
* `$replayAll`. See memegen/3437690. * `$replayAll`. See memegen/3437690.
*/ */
registry.registrar.ConsoleTestUtil.visit = function( registry.registrar.ConsoleTestUtil.visit = function(
@ -72,7 +102,7 @@ registry.registrar.ConsoleTestUtil.visit = function(
goog.testing.mockmatchers.isFunction) goog.testing.mockmatchers.isFunction)
.$does(function(args, cb) { .$does(function(args, cb) {
// XXX: Args should be checked. // XXX: Args should be checked.
var xml = goog.dom.xml.loadXml(opt_args.rspXml); const xml = goog.dom.xml.loadXml(opt_args.rspXml);
goog.asserts.assert(xml != null); goog.asserts.assert(xml != null);
cb(registry.xml.convertToJson(xml)); cb(registry.xml.convertToJson(xml));
}).$anyTimes(); }).$anyTimes();

View file

@ -17,23 +17,21 @@ goog.setTestOnly();
goog.require('goog.array'); goog.require('goog.array');
goog.require('goog.dispose'); goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.soy');
goog.require('goog.testing.MockControl'); goog.require('goog.testing.MockControl');
goog.require('goog.testing.PropertyReplacer'); goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts'); goog.require('goog.testing.asserts');
goog.require('goog.testing.jsunit'); goog.require('goog.testing.jsunit');
goog.require('goog.testing.net.XhrIo'); goog.require('goog.testing.net.XhrIo');
goog.require('registry.registrar.ConsoleTestUtil'); goog.require('registry.registrar.ConsoleTestUtil');
goog.require('registry.soy.registrar.console');
goog.require('registry.testing'); goog.require('registry.testing');
goog.require('registry.util'); goog.require('registry.util');
var $ = goog.dom.getRequiredElement; const $ = goog.dom.getRequiredElement;
var stubs = new goog.testing.PropertyReplacer(); const stubs = new goog.testing.PropertyReplacer();
var testContact = null; let testContact = null;
var test = { const test = {
testXsrfToken: '༼༎෴ ༎༽', testXsrfToken: '༼༎෴ ༎༽',
testClientId: 'testClientId', testClientId: 'testClientId',
mockControl: new goog.testing.MockControl() mockControl: new goog.testing.MockControl()
@ -44,19 +42,9 @@ function setUp() {
registry.testing.addToDocument('<div id="test"/>'); registry.testing.addToDocument('<div id="test"/>');
registry.testing.addToDocument('<div class="kd-butterbar"/>'); registry.testing.addToDocument('<div class="kd-butterbar"/>');
testContact = createTestContact(); testContact = createTestContact();
goog.soy.renderElement($('test'), registry.soy.registrar.console.main, { registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
username: 'blah',
logoutUrl: 'omg',
isAdmin: true,
clientId: test.testClientId, clientId: test.testClientId,
logoFilename: 'logo.png',
productName: 'Nomulus',
integrationEmail: 'integration@google.com',
supportEmail: 'support@google.com',
announcementsEmail: 'announcements@google.com',
supportPhoneNumber: '123 456 7890',
technicalDocsUrl: 'http://example.com/techdocs'
}); });
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo); stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test); registry.registrar.ConsoleTestUtil.setup(test);
@ -208,7 +196,7 @@ function testOneOfManyUpdate() {
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
clientId: test.testClientId clientId: test.testClientId
}); });
var testContacts = [ const testContacts = [
createTestContact('new1@asdf.com'), createTestContact('new1@asdf.com'),
testContact, testContact,
createTestContact('new2@asdf.com') createTestContact('new2@asdf.com')
@ -262,9 +250,9 @@ function testDomainWhoisAbuseContactOverride() {
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
clientId: test.testClientId clientId: test.testClientId
}); });
var oldDomainWhoisAbuseContact = createTestContact('old@asdf.com'); const oldDomainWhoisAbuseContact = createTestContact('old@asdf.com');
oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = true; oldDomainWhoisAbuseContact.visibleInDomainWhoisAsAbuse = true;
var testContacts = [oldDomainWhoisAbuseContact, testContact]; const testContacts = [oldDomainWhoisAbuseContact, testContact];
registry.testing.assertReqMockRsp( registry.testing.assertReqMockRsp(
test.testXsrfToken, test.testXsrfToken,
'/registrar-settings', '/registrar-settings',
@ -299,7 +287,7 @@ function testDelete() {
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
clientId: test.testClientId clientId: test.testClientId
}); });
var testContacts = [ const testContacts = [
createTestContact('new1@asdf.com'), createTestContact('new1@asdf.com'),
testContact, testContact,
createTestContact('new2@asdf.com') createTestContact('new2@asdf.com')
@ -343,10 +331,10 @@ function testDelete() {
/** /**
* @param {string=} opt_email * @param {string=} opt_email
* @return {Object} * @return {!Object}
*/ */
function createTestContact(opt_email) { function createTestContact(opt_email) {
var nameMail = opt_email || 'test@example.com'; const nameMail = opt_email || 'test@example.com';
return { return {
name: nameMail, name: nameMail,
emailAddress: nameMail, emailAddress: nameMail,
@ -363,14 +351,14 @@ function createTestContact(opt_email) {
/** /**
* Convert parsed formContact to simulated wire form. * Convert parsed formContact to simulated wire form.
* @param {!Element} contact * @param {!Element} contact
* @return {Object} * @return {!Object}
*/ */
function simulateJsonForContact(contact) { function simulateJsonForContact(contact) {
contact.visibleInWhoisAsAdmin = contact.visibleInWhoisAsAdmin == 'true'; contact.visibleInWhoisAsAdmin = contact.visibleInWhoisAsAdmin == 'true';
contact.visibleInWhoisAsTech = contact.visibleInWhoisAsTech == 'true'; contact.visibleInWhoisAsTech = contact.visibleInWhoisAsTech == 'true';
contact.visibleInDomainWhoisAsAbuse = contact.visibleInDomainWhoisAsAbuse == 'true'; contact.visibleInDomainWhoisAsAbuse = contact.visibleInDomainWhoisAsAbuse == 'true';
contact.types = ''; contact.types = '';
for (var tNdx in contact.type) { for (const tNdx in contact.type) {
if (contact.type[tNdx]) { if (contact.type[tNdx]) {
if (contact.types.length > 0) { if (contact.types.length > 0) {
contact.types += ','; contact.types += ',';

View file

@ -16,18 +16,16 @@ goog.setTestOnly();
goog.require('goog.dispose'); goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.soy');
goog.require('goog.testing.MockControl'); goog.require('goog.testing.MockControl');
goog.require('goog.testing.asserts'); goog.require('goog.testing.asserts');
goog.require('goog.testing.jsunit'); goog.require('goog.testing.jsunit');
goog.require('registry.registrar.ConsoleTestUtil'); goog.require('registry.registrar.ConsoleTestUtil');
goog.require('registry.soy.registrar.console');
goog.require('registry.testing'); goog.require('registry.testing');
var $ = goog.dom.getRequiredElement; const $ = goog.dom.getRequiredElement;
var test = { const test = {
mockControl: new goog.testing.MockControl() mockControl: new goog.testing.MockControl()
}; };
@ -35,20 +33,7 @@ var test = {
function setUp() { function setUp() {
registry.testing.addToDocument('<div id="test"/>'); registry.testing.addToDocument('<div id="test"/>');
registry.testing.addToDocument('<div class="kd-butterbar"/>'); registry.testing.addToDocument('<div class="kd-butterbar"/>');
goog.soy.renderElement($('test'), registry.soy.registrar.console.main, { registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {});
xsrfToken: 'test',
username: 'blah',
logoutUrl: 'omg',
isAdmin: true,
clientId: 'daddy',
logoFilename: 'logo.png',
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
registry.registrar.ConsoleTestUtil.setup(test); registry.registrar.ConsoleTestUtil.setup(test);
} }
@ -126,7 +111,7 @@ function testEdit() {
/** Contact hash path should nav to contact page. */ /** Contact hash path should nav to contact page. */
function testAddPostalInfo() { function testAddPostalInfo() {
testEdit(); testEdit();
var addPiBtn = $('domain-contact-postalInfo-add-button'); const addPiBtn = $('domain-contact-postalInfo-add-button');
assertNull(addPiBtn.getAttribute('disabled')); assertNull(addPiBtn.getAttribute('disabled'));
registry.testing.click(addPiBtn); registry.testing.click(addPiBtn);
assertTrue(addPiBtn.hasAttribute('disabled')); assertTrue(addPiBtn.hasAttribute('disabled'));

View file

@ -17,7 +17,6 @@ goog.setTestOnly();
goog.require('goog.History'); goog.require('goog.History');
goog.require('goog.dispose'); goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.soy');
goog.require('goog.testing.MockControl'); goog.require('goog.testing.MockControl');
goog.require('goog.testing.PropertyReplacer'); goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts'); goog.require('goog.testing.asserts');
@ -25,36 +24,23 @@ goog.require('goog.testing.jsunit');
goog.require('goog.testing.mockmatchers'); goog.require('goog.testing.mockmatchers');
goog.require('goog.testing.net.XhrIo'); goog.require('goog.testing.net.XhrIo');
goog.require('registry.registrar.Console'); goog.require('registry.registrar.Console');
goog.require('registry.soy.registrar.console'); goog.require('registry.registrar.ConsoleTestUtil');
goog.require('registry.testing'); goog.require('registry.testing');
var $ = goog.dom.getRequiredElement; const $ = goog.dom.getRequiredElement;
var _ = goog.testing.mockmatchers.ignoreArgument; const _ = goog.testing.mockmatchers.ignoreArgument;
var stubs = new goog.testing.PropertyReplacer(); const stubs = new goog.testing.PropertyReplacer();
var mocks = new goog.testing.MockControl(); const mocks = new goog.testing.MockControl();
var historyMock; let historyMock;
var registrarConsole; let registrarConsole;
function setUp() { function setUp() {
registry.testing.addToDocument('<div id="test"/>'); registry.testing.addToDocument('<div id="test"/>');
registry.testing.addToDocument('<div class="kd-butterbar"/>'); registry.testing.addToDocument('<div class="kd-butterbar"/>');
goog.soy.renderElement($('test'), registry.soy.registrar.console.main, { registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {});
xsrfToken: 'ignore',
username: 'jart',
logoutUrl: 'https://justinetunney.com',
isAdmin: true,
clientId: 'ignore',
logoFilename: 'logo.png',
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo); stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
historyMock = mocks.createStrictMock(goog.History); historyMock = mocks.createStrictMock(goog.History);
@ -81,7 +67,7 @@ function tearDown() {
/** Handles EPP login. */ /** Handles EPP login. */
function handleLogin() { function handleLogin() {
var request = registry.testing.loadXml( const request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -101,7 +87,7 @@ function handleLogin() {
' <clTRID>asdf-1235</clTRID>' + ' <clTRID>asdf-1235</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( const response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <response>' + ' <response>' +
@ -114,7 +100,7 @@ function handleLogin() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue(xhr.isActive()); assertTrue(xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']); assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']);
@ -132,7 +118,7 @@ function testView() {
registrarConsole.handleHashChange(); registrarConsole.handleHashChange();
handleLogin(); handleLogin();
var request = registry.testing.loadXml( const request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -144,7 +130,7 @@ function testView() {
' <clTRID>abc-1234</clTRID>' + ' <clTRID>abc-1234</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( const response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <response>' + ' <response>' +
@ -180,7 +166,7 @@ function testView() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue('XHR is inactive.', xhr.isActive()); assertTrue('XHR is inactive.', xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']); assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']);
@ -218,7 +204,7 @@ function testEdit() {
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));
var request = registry.testing.loadXml( let request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -236,7 +222,7 @@ function testEdit() {
' <clTRID>abc-1234</clTRID>' + ' <clTRID>abc-1234</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( let response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <response>' + ' <response>' +
@ -249,7 +235,7 @@ function testEdit() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); let xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue('XHR is inactive.', xhr.isActive()); assertTrue('XHR is inactive.', xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']); assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']);
@ -371,7 +357,7 @@ function testCreate() {
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));
var request = registry.testing.loadXml( let request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -391,7 +377,7 @@ function testCreate() {
' <clTRID>abc-1234</clTRID>' + ' <clTRID>abc-1234</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( let response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <response>' + ' <response>' +
@ -411,7 +397,7 @@ function testCreate() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); let xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue('XHR is inactive.', xhr.isActive()); assertTrue('XHR is inactive.', xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']); assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']);

View file

@ -17,7 +17,6 @@ goog.setTestOnly();
goog.require('goog.History'); goog.require('goog.History');
goog.require('goog.dispose'); goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.soy');
goog.require('goog.testing.MockControl'); goog.require('goog.testing.MockControl');
goog.require('goog.testing.PropertyReplacer'); goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts'); goog.require('goog.testing.asserts');
@ -25,36 +24,23 @@ goog.require('goog.testing.jsunit');
goog.require('goog.testing.mockmatchers'); goog.require('goog.testing.mockmatchers');
goog.require('goog.testing.net.XhrIo'); goog.require('goog.testing.net.XhrIo');
goog.require('registry.registrar.Console'); goog.require('registry.registrar.Console');
goog.require('registry.soy.registrar.console'); goog.require('registry.registrar.ConsoleTestUtil');
goog.require('registry.testing'); goog.require('registry.testing');
var $ = goog.dom.getRequiredElement; const $ = goog.dom.getRequiredElement;
var _ = goog.testing.mockmatchers.ignoreArgument; const _ = goog.testing.mockmatchers.ignoreArgument;
var stubs = new goog.testing.PropertyReplacer(); const stubs = new goog.testing.PropertyReplacer();
var mocks = new goog.testing.MockControl(); const mocks = new goog.testing.MockControl();
var historyMock; let historyMock;
var registrarConsole; let registrarConsole;
function setUp() { function setUp() {
registry.testing.addToDocument('<div id="test"/>'); registry.testing.addToDocument('<div id="test"/>');
registry.testing.addToDocument('<div class="kd-butterbar"/>'); registry.testing.addToDocument('<div class="kd-butterbar"/>');
goog.soy.renderElement($('test'), registry.soy.registrar.console.main, { registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {});
xsrfToken: 'ignore',
username: 'jart',
logoutUrl: 'https://example.com',
isAdmin: true,
clientId: 'ignore',
logoFilename: 'logo.png',
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
});
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo); stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
historyMock = mocks.createStrictMock(goog.History); historyMock = mocks.createStrictMock(goog.History);
@ -81,7 +67,7 @@ function tearDown() {
/** Handles EPP login. */ /** Handles EPP login. */
function handleLogin() { function handleLogin() {
var request = registry.testing.loadXml( const request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -101,7 +87,7 @@ function handleLogin() {
' <clTRID>asdf-1235</clTRID>' + ' <clTRID>asdf-1235</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( const response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <response>' + ' <response>' +
@ -114,7 +100,7 @@ function handleLogin() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue(xhr.isActive()); assertTrue(xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']); assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']);
@ -132,7 +118,7 @@ function testView() {
registrarConsole.handleHashChange(); registrarConsole.handleHashChange();
handleLogin(); handleLogin();
var request = registry.testing.loadXml( const request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -144,7 +130,7 @@ function testView() {
' <clTRID>abc-1234</clTRID>' + ' <clTRID>abc-1234</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( const response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0"' +
' xmlns:host="urn:ietf:params:xml:ns:host-1.0">' + ' xmlns:host="urn:ietf:params:xml:ns:host-1.0">' +
@ -170,7 +156,7 @@ function testView() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue('XHR is inactive.', xhr.isActive()); assertTrue('XHR is inactive.', xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('application/epp+xml', assertEquals('application/epp+xml',
@ -207,7 +193,7 @@ function testEditFirstAddr_ignoreSecond_addThird() {
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));
var request = registry.testing.loadXml( let request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -226,7 +212,7 @@ function testEditFirstAddr_ignoreSecond_addThird() {
' <clTRID>abc-1234</clTRID>' + ' <clTRID>abc-1234</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( let response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <response>' + ' <response>' +
@ -239,7 +225,7 @@ function testEditFirstAddr_ignoreSecond_addThird() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); let xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue('XHR is inactive.', xhr.isActive()); assertTrue('XHR is inactive.', xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']); assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']);
@ -327,7 +313,7 @@ function testCreate() {
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));
var request = registry.testing.loadXml( let request = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <command>' + ' <command>' +
@ -342,7 +328,7 @@ function testCreate() {
' <clTRID>abc-1234</clTRID>' + ' <clTRID>abc-1234</clTRID>' +
' </command>' + ' </command>' +
'</epp>'); '</epp>');
var response = registry.testing.loadXml( let response = registry.testing.loadXml(
'<?xml version="1.0"?>' + '<?xml version="1.0"?>' +
'<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' + '<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">' +
' <response>' + ' <response>' +
@ -361,7 +347,7 @@ function testCreate() {
' </trID>' + ' </trID>' +
' </response>' + ' </response>' +
'</epp>'); '</epp>');
var xhr = goog.testing.net.XhrIo.getSendInstances().pop(); let xhr = goog.testing.net.XhrIo.getSendInstances().pop();
assertTrue('XHR is inactive.', xhr.isActive()); assertTrue('XHR is inactive.', xhr.isActive());
assertEquals('/registrar-xhr', xhr.getLastUri()); assertEquals('/registrar-xhr', xhr.getLastUri());
assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']); assertEquals('☢', xhr.getLastRequestHeaders()['X-CSRF-Token']);

View file

@ -16,22 +16,20 @@ goog.setTestOnly();
goog.require('goog.dispose'); goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.soy');
goog.require('goog.testing.MockControl'); goog.require('goog.testing.MockControl');
goog.require('goog.testing.PropertyReplacer'); goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts'); goog.require('goog.testing.asserts');
goog.require('goog.testing.jsunit'); goog.require('goog.testing.jsunit');
goog.require('goog.testing.net.XhrIo'); goog.require('goog.testing.net.XhrIo');
goog.require('registry.registrar.ConsoleTestUtil'); goog.require('registry.registrar.ConsoleTestUtil');
goog.require('registry.soy.registrar.console');
goog.require('registry.testing'); goog.require('registry.testing');
goog.require('registry.util'); goog.require('registry.util');
var $ = goog.dom.getRequiredElement; const $ = goog.dom.getRequiredElement;
var stubs = new goog.testing.PropertyReplacer(); const stubs = new goog.testing.PropertyReplacer();
var expectedRegistrar = { const expectedRegistrar = {
ipAddressWhitelist: [], ipAddressWhitelist: [],
phonePasscode: '12345', phonePasscode: '12345',
clientCertificate: null, clientCertificate: null,
@ -39,7 +37,7 @@ var expectedRegistrar = {
failoverClientCertificate: null failoverClientCertificate: null
}; };
var test = { const test = {
testXsrfToken: '༼༎෴ ༎༽', testXsrfToken: '༼༎෴ ༎༽',
testClientId: 'testClientId', testClientId: 'testClientId',
mockControl: new goog.testing.MockControl() mockControl: new goog.testing.MockControl()
@ -49,19 +47,9 @@ var test = {
function setUp() { function setUp() {
registry.testing.addToDocument('<div id="test"/>'); registry.testing.addToDocument('<div id="test"/>');
registry.testing.addToDocument('<div class="kd-butterbar"/>'); registry.testing.addToDocument('<div class="kd-butterbar"/>');
goog.soy.renderElement($('test'), registry.soy.registrar.console.main, { registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
username: 'jart',
logoutUrl: 'https://example.com',
isAdmin: true,
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
clientId: test.testClientId, clientId: test.testClientId,
logoFilename: 'logo.png',
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
}); });
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo); stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test); registry.registrar.ConsoleTestUtil.setup(test);
@ -101,14 +89,14 @@ function testEdit() {
registry.testing.click($('reg-app-btn-edit')); registry.testing.click($('reg-app-btn-edit'));
var form = document.forms.namedItem('item'); const form = document.forms.namedItem('item');
form.elements['newIp'].value = '1.1.1.1'; form.elements['newIp'].value = '1.1.1.1';
registry.testing.click($('btn-add-ip')); registry.testing.click($('btn-add-ip'));
form.elements['newIp'].value = '2.2.2.2'; form.elements['newIp'].value = '2.2.2.2';
registry.testing.click($('btn-add-ip')); registry.testing.click($('btn-add-ip'));
var exampleCert = $('exampleCert').value; const exampleCert = $('exampleCert').value;
var exampleCertHash = '6NKKNBnd2fKFooBINmn3V7L3JOTHh02+2lAqYHdlTgk'; const exampleCertHash = '6NKKNBnd2fKFooBINmn3V7L3JOTHh02+2lAqYHdlTgk';
form.elements['clientCertificate'].value = exampleCert; form.elements['clientCertificate'].value = exampleCert;
form.elements['failoverClientCertificate'].value = 'bourgeois blues'; form.elements['failoverClientCertificate'].value = 'bourgeois blues';
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));

View file

@ -17,23 +17,21 @@ goog.setTestOnly();
goog.require('goog.dispose'); goog.require('goog.dispose');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.dom.classlist'); goog.require('goog.dom.classlist');
goog.require('goog.soy');
goog.require('goog.testing.MockControl'); goog.require('goog.testing.MockControl');
goog.require('goog.testing.PropertyReplacer'); goog.require('goog.testing.PropertyReplacer');
goog.require('goog.testing.asserts'); goog.require('goog.testing.asserts');
goog.require('goog.testing.jsunit'); goog.require('goog.testing.jsunit');
goog.require('goog.testing.net.XhrIo'); goog.require('goog.testing.net.XhrIo');
goog.require('registry.registrar.ConsoleTestUtil'); goog.require('registry.registrar.ConsoleTestUtil');
goog.require('registry.soy.registrar.console');
goog.require('registry.testing'); goog.require('registry.testing');
goog.require('registry.util'); goog.require('registry.util');
var $ = goog.dom.getRequiredElement; const $ = goog.dom.getRequiredElement;
var $$ = goog.dom.getRequiredElementByClass; const $$ = goog.dom.getRequiredElementByClass;
var stubs = new goog.testing.PropertyReplacer(); const stubs = new goog.testing.PropertyReplacer();
var test = { const test = {
testXsrfToken: '༼༎෴ ༎༽', testXsrfToken: '༼༎෴ ༎༽',
testClientId: 'testClientId', testClientId: 'testClientId',
mockControl: new goog.testing.MockControl() mockControl: new goog.testing.MockControl()
@ -43,19 +41,9 @@ var test = {
function setUp() { function setUp() {
registry.testing.addToDocument('<div id="test"/>'); registry.testing.addToDocument('<div id="test"/>');
registry.testing.addToDocument('<div class="kd-butterbar"/>'); registry.testing.addToDocument('<div class="kd-butterbar"/>');
goog.soy.renderElement($('test'), registry.soy.registrar.console.main, { registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
username: 'blah',
logoutUrl: 'omg',
isAdmin: true,
clientId: test.testClientId, clientId: test.testClientId,
logoFilename: 'logo.png',
productName: 'Nomulus',
integrationEmail: 'integration@example.com',
supportEmail: 'support@example.com',
announcementsEmail: 'announcement@example.com',
supportPhoneNumber: '+1 (888) 555 0123',
technicalDocsUrl: 'http://example.com/techdocs'
}); });
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo); stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
registry.registrar.ConsoleTestUtil.setup(test); registry.registrar.ConsoleTestUtil.setup(test);
@ -72,7 +60,7 @@ function tearDown() {
/** /**
* Creates test registrar. * Creates test registrar.
* @return {Object} * @return {!Object}
*/ */
function createTestRegistrar() { function createTestRegistrar() {
return { return {
@ -100,7 +88,7 @@ function testView() {
xsrfToken: test.testXsrfToken, xsrfToken: test.testXsrfToken,
clientId: test.testClientId clientId: test.testClientId
}); });
var testRegistrar = createTestRegistrar(); const testRegistrar = createTestRegistrar();
registry.testing.assertReqMockRsp( registry.testing.assertReqMockRsp(
test.testXsrfToken, test.testXsrfToken,
'/registrar-settings', '/registrar-settings',
@ -110,7 +98,7 @@ function testView() {
message: 'OK', message: 'OK',
results: [testRegistrar] results: [testRegistrar]
}); });
var parsed = registry.util.parseForm('item'); const parsed = registry.util.parseForm('item');
parsed.ianaIdentifier = parseInt(parsed.ianaIdentifier); parsed.ianaIdentifier = parseInt(parsed.ianaIdentifier);
registry.testing.assertObjectEqualsPretty(testRegistrar, parsed); registry.testing.assertObjectEqualsPretty(testRegistrar, parsed);
} }
@ -123,7 +111,7 @@ function testEdit() {
$('localizedAddress.street[0]').value = 'look at me i am'; $('localizedAddress.street[0]').value = 'look at me i am';
$('localizedAddress.street[1]').value = 'the mistress of the night'; $('localizedAddress.street[1]').value = 'the mistress of the night';
$('localizedAddress.street[2]').value = ''; $('localizedAddress.street[2]').value = '';
var parsed = registry.util.parseForm('item'); const parsed = registry.util.parseForm('item');
parsed.readonly = false; parsed.readonly = false;
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));
registry.testing.assertReqMockRsp( registry.testing.assertReqMockRsp(
@ -142,10 +130,10 @@ function testEditFieldError_insertsError() {
testView(); testView();
registry.testing.click($('reg-app-btn-edit')); registry.testing.click($('reg-app-btn-edit'));
$('phoneNumber').value = 'foo'; $('phoneNumber').value = 'foo';
var parsed = registry.util.parseForm('item'); const parsed = registry.util.parseForm('item');
parsed.readonly = false; parsed.readonly = false;
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));
var errMsg = 'Carpe brunchus. --Pablo'; const errMsg = 'Carpe brunchus. --Pablo';
registry.testing.assertReqMockRsp( registry.testing.assertReqMockRsp(
test.testXsrfToken, test.testXsrfToken,
'/registrar-settings', '/registrar-settings',
@ -155,7 +143,7 @@ function testEditFieldError_insertsError() {
field: 'phoneNumber', field: 'phoneNumber',
message: errMsg message: errMsg
}); });
var msgBox = goog.dom.getNextElementSibling($('phoneNumber')); const msgBox = goog.dom.getNextElementSibling($('phoneNumber'));
assertTrue(goog.dom.classlist.contains(msgBox, 'kd-errormessage')); assertTrue(goog.dom.classlist.contains(msgBox, 'kd-errormessage'));
assertTrue(goog.dom.classlist.contains($('phoneNumber'), 'kd-formerror')); assertTrue(goog.dom.classlist.contains($('phoneNumber'), 'kd-formerror'));
assertEquals(errMsg, goog.dom.getTextContent(msgBox)); assertEquals(errMsg, goog.dom.getTextContent(msgBox));
@ -165,10 +153,10 @@ function testEditFieldError_insertsError() {
function testEditNonFieldError_showsButterBar() { function testEditNonFieldError_showsButterBar() {
testView(); testView();
registry.testing.click($('reg-app-btn-edit')); registry.testing.click($('reg-app-btn-edit'));
var parsed = registry.util.parseForm('item'); const parsed = registry.util.parseForm('item');
parsed.readonly = false; parsed.readonly = false;
registry.testing.click($('reg-app-btn-save')); registry.testing.click($('reg-app-btn-save'));
var errMsg = 'One must still have chaos in oneself to be able to give ' + const errMsg = 'One must still have chaos in oneself to be able to give ' +
'birth to a dancing star. --Nietzsche'; 'birth to a dancing star. --Nietzsche';
registry.testing.assertReqMockRsp( registry.testing.assertReqMockRsp(
test.testXsrfToken, test.testXsrfToken,