mirror of
https://github.com/google/nomulus.git
synced 2025-07-09 12:43:24 +02:00
Move the Javascript tests to use Jasmine/Karma
This commit is contained in:
parent
e378855093
commit
b644a9f4c9
12 changed files with 4012 additions and 689 deletions
|
@ -558,6 +558,15 @@ compileProdJS.dependsOn processTestResources
|
|||
compileProdJS.dependsOn soyToJS
|
||||
assemble.dependsOn compileProdJS
|
||||
|
||||
task karmaTest(type: Exec) {
|
||||
dependsOn ':npmInstall'
|
||||
workingDir rootProject.projectDir
|
||||
executable 'node_modules/karma/bin/karma'
|
||||
args('start')
|
||||
}
|
||||
|
||||
test.dependsOn karmaTest
|
||||
|
||||
// Make testing artifacts available to be depended up on by other projects.
|
||||
// TODO: factor out google.registry.testing to be a separate project.
|
||||
task testJar(type: Jar) {
|
||||
|
|
|
@ -16,28 +16,25 @@ goog.setTestOnly();
|
|||
|
||||
goog.require('goog.dispose');
|
||||
goog.require('goog.testing.MockControl');
|
||||
goog.require('goog.testing.jsunit');
|
||||
goog.require('registry.Component');
|
||||
goog.require('registry.Console');
|
||||
|
||||
describe("component test", function() {
|
||||
let mocks;
|
||||
|
||||
var mocks = new goog.testing.MockControl();
|
||||
|
||||
|
||||
function setUp() {
|
||||
beforeEach(function() {
|
||||
mocks = new goog.testing.MockControl();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function tearDown() {
|
||||
afterEach(function() {
|
||||
mocks.$tearDown();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testCreationAndDisposal_dontTouchConsoleObject() {
|
||||
it("testCreationAndDisposal_dontTouchConsoleObject", function() {
|
||||
var console = mocks.createStrictMock(registry.Console);
|
||||
mocks.$replayAll();
|
||||
var component = new registry.Component(console);
|
||||
goog.dispose(component);
|
||||
mocks.$verifyAll();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,14 +19,12 @@ goog.require('goog.dom.classlist');
|
|||
goog.require('goog.json');
|
||||
goog.require('goog.testing.MockControl');
|
||||
goog.require('goog.testing.PropertyReplacer');
|
||||
goog.require('goog.testing.asserts');
|
||||
goog.require('goog.testing.jsunit');
|
||||
goog.require('goog.testing.net.XhrIo');
|
||||
goog.require('registry.registrar.ConsoleTestUtil');
|
||||
goog.require('registry.testing');
|
||||
goog.require('registry.util');
|
||||
|
||||
|
||||
describe("console tests", function() {
|
||||
const $ = goog.dom.getRequiredElement;
|
||||
const stubs = new goog.testing.PropertyReplacer();
|
||||
|
||||
|
@ -36,8 +34,7 @@ const test = {
|
|||
mockControl: new goog.testing.MockControl()
|
||||
};
|
||||
|
||||
|
||||
function setUp() {
|
||||
beforeEach(function() {
|
||||
registry.testing.addToDocument('<div id="test"/>');
|
||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
|
@ -48,38 +45,34 @@ function setUp() {
|
|||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
const regNavlist = $('reg-navlist');
|
||||
const active = regNavlist.querySelector('a[href="#contact-us"]');
|
||||
assertTrue(active != null);
|
||||
}
|
||||
expect(active).not.toBeNull();
|
||||
});
|
||||
|
||||
|
||||
function tearDown() {
|
||||
afterEach(function() {
|
||||
goog.testing.net.XhrIo.cleanup();
|
||||
stubs.reset();
|
||||
test.mockControl.$tearDown();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testButter() {
|
||||
it("testButter", function() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
productName: 'Foo Registry'
|
||||
});
|
||||
registry.util.butter('butter msg');
|
||||
const butter = goog.dom.getElementByClass(goog.getCssName('kd-butterbar'));
|
||||
assertNotNull(butter.innerHTML.match(/.*butter msg.*/));
|
||||
assertTrue(goog.dom.classlist.contains(butter, goog.getCssName('shown')));
|
||||
}
|
||||
|
||||
expect(butter.innerHTML.match(/.*butter msg.*/)).not.toBeNull();
|
||||
expect(goog.dom.classlist.contains(butter, goog.getCssName('shown'))).toBe(true);
|
||||
});
|
||||
|
||||
/** Authed user with no path op specified should nav to welcome page. */
|
||||
function testShowLoginOrDash() {
|
||||
it("testShowLoginOrDash", function() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
productName: 'Foo Registry'
|
||||
});
|
||||
assertNotNull(goog.dom.getElement('domain-registrar-dashboard'));
|
||||
}
|
||||
expect(goog.dom.getElement('domain-registrar-dashboard')).not.toBeNull();
|
||||
});
|
||||
|
||||
|
||||
function testNavToResources() {
|
||||
it("testNavToResources", function() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'resources',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
|
@ -87,9 +80,9 @@ function testNavToResources() {
|
|||
readonly: true,
|
||||
});
|
||||
const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
||||
assertTrue(xhr.isActive());
|
||||
assertEquals('/registrar-settings', xhr.getLastUri());
|
||||
assertEquals(test.testXsrfToken,
|
||||
expect(xhr.isActive()).toBe(true);
|
||||
expect('/registrar-settings').toEqual(xhr.getLastUri());
|
||||
expect(test.testXsrfToken).toEqual(
|
||||
xhr.getLastRequestHeaders()['X-CSRF-Token']);
|
||||
xhr.simulateResponse(200, goog.json.serialize({
|
||||
status: 'SUCCESS',
|
||||
|
@ -98,11 +91,10 @@ function testNavToResources() {
|
|||
driveFolderId: 'blahblah'
|
||||
}]
|
||||
}));
|
||||
assertContains('blahblah', $('reg-resources-driveLink').getAttribute('href'));
|
||||
}
|
||||
expect($('reg-resources-driveLink').getAttribute('href')).toContain('blahblah');
|
||||
});
|
||||
|
||||
|
||||
function testNavToContactUs() {
|
||||
it("testNavToContactUs", function() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-us',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
|
@ -113,9 +105,9 @@ function testNavToContactUs() {
|
|||
supportPhoneNumber: '+1 (888) 555 0123'
|
||||
});
|
||||
const xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
||||
assertTrue(xhr.isActive());
|
||||
assertEquals('/registrar-settings', xhr.getLastUri());
|
||||
assertEquals(test.testXsrfToken,
|
||||
expect(xhr.isActive()).toBe(true);
|
||||
expect('/registrar-settings').toEqual(xhr.getLastUri());
|
||||
expect(test.testXsrfToken).toEqual(
|
||||
xhr.getLastRequestHeaders()['X-CSRF-Token']);
|
||||
const passcode = '5-5-5-5-5';
|
||||
xhr.simulateResponse(200, goog.json.serialize({
|
||||
|
@ -125,6 +117,7 @@ function testNavToContactUs() {
|
|||
phonePasscode: passcode
|
||||
}]
|
||||
}));
|
||||
assertEquals(passcode,
|
||||
expect(passcode).toEqual(
|
||||
goog.dom.getTextContent($('domain-registrar-phone-passcode')));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,14 +19,12 @@ goog.require('goog.dispose');
|
|||
goog.require('goog.dom');
|
||||
goog.require('goog.testing.MockControl');
|
||||
goog.require('goog.testing.PropertyReplacer');
|
||||
goog.require('goog.testing.asserts');
|
||||
goog.require('goog.testing.jsunit');
|
||||
goog.require('goog.testing.net.XhrIo');
|
||||
goog.require('registry.registrar.ConsoleTestUtil');
|
||||
goog.require('registry.testing');
|
||||
goog.require('registry.util');
|
||||
|
||||
|
||||
describe("contact settings test", function() {
|
||||
const $ = goog.dom.getRequiredElement;
|
||||
const stubs = new goog.testing.PropertyReplacer();
|
||||
let testContact = null;
|
||||
|
@ -37,8 +35,7 @@ const test = {
|
|||
mockControl: new goog.testing.MockControl()
|
||||
};
|
||||
|
||||
|
||||
function setUp() {
|
||||
beforeEach(function() {
|
||||
registry.testing.addToDocument('<div id="test"/>');
|
||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||
testContact = createTestContact();
|
||||
|
@ -48,18 +45,16 @@ function setUp() {
|
|||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function tearDown() {
|
||||
afterEach(function() {
|
||||
goog.dispose(test.console);
|
||||
goog.testing.net.XhrIo.cleanup();
|
||||
stubs.reset();
|
||||
test.mockControl.$tearDown();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testCollectionView() {
|
||||
it("testCollectionView", function() {
|
||||
testContactWithoutType = createTestContact('notype@example.com');
|
||||
testContactWithoutType.types = '';
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
|
@ -79,41 +74,24 @@ function testCollectionView() {
|
|||
}]
|
||||
}
|
||||
);
|
||||
assertEquals(1, $('admin-contacts').childNodes.length);
|
||||
assertEquals(1, $('other-contacts').childNodes.length);
|
||||
expect(1).toEqual($('admin-contacts').childNodes.length);
|
||||
expect(1).toEqual($('other-contacts').childNodes.length);
|
||||
// XXX: Needs more field testing.
|
||||
}
|
||||
|
||||
|
||||
function testItemView() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-settings/test@example.com',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
clientId: test.testClientId
|
||||
});
|
||||
registry.testing.assertReqMockRsp(
|
||||
test.testXsrfToken,
|
||||
'/registrar-settings',
|
||||
{op: 'read', id: 'testClientId', args: {}},
|
||||
{
|
||||
status: 'SUCCESS',
|
||||
message: 'OK',
|
||||
results: [{
|
||||
contacts: [testContact]
|
||||
}]
|
||||
}
|
||||
);
|
||||
assertEquals(testContact.name, $('contacts[0].name').value);
|
||||
assertEquals(testContact.emailAddress, $('contacts[0].emailAddress').value);
|
||||
assertEquals(testContact.phoneNumber, $('contacts[0].phoneNumber').value);
|
||||
assertEquals(testContact.faxNumber, $('contacts[0].faxNumber').value);
|
||||
|
||||
|
||||
it("testItemView", function() {
|
||||
testItemView();
|
||||
expect(testContact.name).toEqual($('contacts[0].name').value);
|
||||
expect(testContact.emailAddress).toEqual($('contacts[0].emailAddress').value);
|
||||
expect(testContact.phoneNumber).toEqual($('contacts[0].phoneNumber').value);
|
||||
expect(testContact.faxNumber).toEqual($('contacts[0].faxNumber').value);
|
||||
// XXX: Types are no longer broken out as individual settings, so relying on
|
||||
// screenshot test.
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// XXX: Should be hoisted.
|
||||
function testItemEditButtons() {
|
||||
it("testItemEditButtons", function() {
|
||||
testItemView();
|
||||
registry.testing.assertVisible($('reg-app-btns-edit'));
|
||||
registry.testing.assertHidden($('reg-app-btns-save'));
|
||||
|
@ -123,10 +101,9 @@ function testItemEditButtons() {
|
|||
registry.testing.click($('reg-app-btn-cancel'));
|
||||
registry.testing.assertVisible($('reg-app-btns-edit'));
|
||||
registry.testing.assertHidden($('reg-app-btns-save'));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testItemEdit() {
|
||||
it("testItemEdit", function() {
|
||||
testItemView();
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
$('contacts[0].name').setAttribute('value', 'bob');
|
||||
|
@ -154,10 +131,9 @@ function testItemEdit() {
|
|||
registry.testing.assertObjectEqualsPretty(
|
||||
testContact,
|
||||
simulateJsonForContact(registry.util.parseForm('item').contacts[0]));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testChangeContactTypes() {
|
||||
it("testChangeContactTypes", function() {
|
||||
testItemView();
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
$('contacts[0].type.admin').removeAttribute('checked');
|
||||
|
@ -187,10 +163,9 @@ function testChangeContactTypes() {
|
|||
registry.testing.assertObjectEqualsPretty(
|
||||
testContact,
|
||||
simulateJsonForContact(registry.util.parseForm('item').contacts[0]));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testOneOfManyUpdate() {
|
||||
it("testOneOfManyUpdate", function() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-settings/test@example.com',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
|
@ -241,10 +216,9 @@ function testOneOfManyUpdate() {
|
|||
}]
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testDomainWhoisAbuseContactOverride() {
|
||||
it("testDomainWhoisAbuseContactOverride", function() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-settings/test@example.com',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
|
@ -278,10 +252,9 @@ function testDomainWhoisAbuseContactOverride() {
|
|||
args: {contacts: testContacts, readonly: false},
|
||||
},
|
||||
{status: 'SUCCESS', message: 'OK', results: [{contacts: testContacts}]});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testDelete() {
|
||||
it("testDelete", function() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-settings/test@example.com',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
|
@ -326,8 +299,27 @@ function testDelete() {
|
|||
}]
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
function testItemView() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'contact-settings/test@example.com',
|
||||
xsrfToken: test.testXsrfToken,
|
||||
clientId: test.testClientId
|
||||
});
|
||||
registry.testing.assertReqMockRsp(
|
||||
test.testXsrfToken,
|
||||
'/registrar-settings',
|
||||
{op: 'read', id: 'testClientId', args: {}},
|
||||
{
|
||||
status: 'SUCCESS',
|
||||
message: 'OK',
|
||||
results: [{
|
||||
contacts: [testContact]
|
||||
}]
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string=} opt_email
|
||||
|
@ -369,3 +361,5 @@ function simulateJsonForContact(contact) {
|
|||
delete contact['type'];
|
||||
return contact;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -18,14 +18,12 @@ goog.require('goog.dispose');
|
|||
goog.require('goog.dom');
|
||||
goog.require('goog.testing.MockControl');
|
||||
goog.require('goog.testing.PropertyReplacer');
|
||||
goog.require('goog.testing.asserts');
|
||||
goog.require('goog.testing.jsunit');
|
||||
goog.require('goog.testing.net.XhrIo');
|
||||
goog.require('registry.registrar.ConsoleTestUtil');
|
||||
goog.require('registry.testing');
|
||||
goog.require('registry.util');
|
||||
|
||||
|
||||
describe('security settings test', function() {
|
||||
const $ = goog.dom.getRequiredElement;
|
||||
const stubs = new goog.testing.PropertyReplacer();
|
||||
|
||||
|
@ -43,8 +41,7 @@ const test = {
|
|||
mockControl: new goog.testing.MockControl()
|
||||
};
|
||||
|
||||
|
||||
function setUp() {
|
||||
beforeEach(function() {
|
||||
registry.testing.addToDocument('<div id="test"/>');
|
||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
||||
|
@ -53,16 +50,14 @@ function setUp() {
|
|||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function tearDown() {
|
||||
afterEach(function() {
|
||||
goog.dispose(test.console);
|
||||
goog.testing.net.XhrIo.cleanup();
|
||||
stubs.reset();
|
||||
test.mockControl.$tearDown();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function testView() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
|
@ -79,12 +74,14 @@ function testView() {
|
|||
message: 'OK',
|
||||
results: [expectedRegistrar]
|
||||
});
|
||||
assertEquals(expectedRegistrar.phonePasscode,
|
||||
registry.util.parseForm('item').phonePasscode);
|
||||
expect(expectedRegistrar.phonePasscode).toEqual(registry.util.parseForm('item').phonePasscode);
|
||||
}
|
||||
|
||||
it("testView", function() {
|
||||
testView();
|
||||
});
|
||||
|
||||
function testEdit() {
|
||||
it("testEdit", function() {
|
||||
testView();
|
||||
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
|
@ -133,4 +130,5 @@ function testEdit() {
|
|||
delete expectedRegistrar['clientCertificateHash'];
|
||||
registry.testing.assertObjectEqualsPretty(
|
||||
expectedRegistrar, registry.util.parseForm('item'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,14 +19,12 @@ goog.require('goog.dom');
|
|||
goog.require('goog.dom.classlist');
|
||||
goog.require('goog.testing.MockControl');
|
||||
goog.require('goog.testing.PropertyReplacer');
|
||||
goog.require('goog.testing.asserts');
|
||||
goog.require('goog.testing.jsunit');
|
||||
goog.require('goog.testing.net.XhrIo');
|
||||
goog.require('registry.registrar.ConsoleTestUtil');
|
||||
goog.require('registry.testing');
|
||||
goog.require('registry.util');
|
||||
|
||||
|
||||
describe("whois settings test", function() {
|
||||
const $ = goog.dom.getRequiredElement;
|
||||
const $$ = goog.dom.getRequiredElementByClass;
|
||||
const stubs = new goog.testing.PropertyReplacer();
|
||||
|
@ -37,8 +35,7 @@ const test = {
|
|||
mockControl: new goog.testing.MockControl()
|
||||
};
|
||||
|
||||
|
||||
function setUp() {
|
||||
beforeEach(function() {
|
||||
registry.testing.addToDocument('<div id="test"/>');
|
||||
registry.testing.addToDocument('<div class="kd-butterbar"/>');
|
||||
registry.registrar.ConsoleTestUtil.renderConsoleMain($('test'), {
|
||||
|
@ -47,16 +44,14 @@ function setUp() {
|
|||
});
|
||||
stubs.setPath('goog.net.XhrIo', goog.testing.net.XhrIo);
|
||||
registry.registrar.ConsoleTestUtil.setup(test);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function tearDown() {
|
||||
afterEach(function() {
|
||||
goog.dispose(test.console);
|
||||
stubs.reset();
|
||||
goog.testing.net.XhrIo.cleanup();
|
||||
test.mockControl.$tearDown();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates test registrar.
|
||||
|
@ -81,7 +76,6 @@ function createTestRegistrar() {
|
|||
}};
|
||||
}
|
||||
|
||||
|
||||
function testView() {
|
||||
registry.registrar.ConsoleTestUtil.visit(test, {
|
||||
path: 'whois-settings',
|
||||
|
@ -103,8 +97,11 @@ function testView() {
|
|||
registry.testing.assertObjectEqualsPretty(testRegistrar, parsed);
|
||||
}
|
||||
|
||||
it("testView", function() {
|
||||
testView();
|
||||
});
|
||||
|
||||
function testEdit() {
|
||||
it("testEdit", function() {
|
||||
testView();
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
$('emailAddress').value = 'test2.ui@example.com';
|
||||
|
@ -123,10 +120,9 @@ function testEdit() {
|
|||
message: 'OK',
|
||||
results: [parsed]
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function testEditFieldError_insertsError() {
|
||||
it("testEditFieldError_insertsError", function() {
|
||||
testView();
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
$('phoneNumber').value = 'foo';
|
||||
|
@ -144,13 +140,12 @@ function testEditFieldError_insertsError() {
|
|||
message: errMsg
|
||||
});
|
||||
const msgBox = goog.dom.getNextElementSibling($('phoneNumber'));
|
||||
assertTrue(goog.dom.classlist.contains(msgBox, 'kd-errormessage'));
|
||||
assertTrue(goog.dom.classlist.contains($('phoneNumber'), 'kd-formerror'));
|
||||
assertEquals(errMsg, goog.dom.getTextContent(msgBox));
|
||||
}
|
||||
expect(goog.dom.classlist.contains(msgBox, 'kd-errormessage')).toBe(true);
|
||||
expect(goog.dom.classlist.contains($('phoneNumber'), 'kd-formerror')).toBe(true);
|
||||
expect(errMsg).toEqual(goog.dom.getTextContent(msgBox));
|
||||
});
|
||||
|
||||
|
||||
function testEditNonFieldError_showsButterBar() {
|
||||
it("testEditNonFieldError_showsButterBar", function() {
|
||||
testView();
|
||||
registry.testing.click($('reg-app-btn-edit'));
|
||||
const parsed = registry.util.parseForm('item');
|
||||
|
@ -166,5 +161,6 @@ function testEditNonFieldError_showsButterBar() {
|
|||
status: 'ERROR',
|
||||
message: errMsg
|
||||
});
|
||||
assertEquals(errMsg, goog.dom.getTextContent($$('kd-butterbar-text')));
|
||||
}
|
||||
expect(errMsg).toEqual(goog.dom.getTextContent($$('kd-butterbar-text')));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -53,8 +53,7 @@ registry.testing.click = function(element) {
|
|||
* @param {!Element} element
|
||||
*/
|
||||
registry.testing.assertVisible = function(element) {
|
||||
assertTrue('Element should have CSS "shown" class',
|
||||
goog.dom.classlist.contains(element, 'shown'));
|
||||
expect(goog.dom.classlist.contains(element, 'shown')).toBe(true);
|
||||
};
|
||||
|
||||
|
||||
|
@ -63,8 +62,7 @@ registry.testing.assertVisible = function(element) {
|
|||
* @param {!Element} element
|
||||
*/
|
||||
registry.testing.assertHidden = function(element) {
|
||||
assertTrue('Element should have CSS "hidden" class',
|
||||
goog.dom.classlist.contains(element, 'hidden'));
|
||||
expect(goog.dom.classlist.contains(element, 'hidden')).toBe(true);
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,7 +73,7 @@ registry.testing.assertHidden = function(element) {
|
|||
*/
|
||||
registry.testing.assertObjectEqualsPretty = function(a, b) {
|
||||
try {
|
||||
assertObjectEquals(a, b);
|
||||
expect(a).toEqual(b);
|
||||
} catch (e) {
|
||||
e.message = e.message + '\n' +
|
||||
'expected: ' + registry.testing.pretty_.format(a) + '\n' +
|
||||
|
@ -96,8 +94,8 @@ registry.testing.assertObjectEqualsPretty = function(a, b) {
|
|||
registry.testing.assertReqMockRsp =
|
||||
function(xsrfToken, path, expectReqJson, mockRspJson) {
|
||||
var xhr = goog.testing.net.XhrIo.getSendInstances().pop();
|
||||
assertTrue('XHR is active.', xhr.isActive());
|
||||
assertEquals(path, xhr.getLastUri());
|
||||
expect(xhr.isActive()).toBe(true);
|
||||
expect(path).toEqual(xhr.getLastUri());
|
||||
// XXX: XHR header checking should probably be added. Was inconsistent
|
||||
// between admin and registrar consoles.
|
||||
registry.testing.assertObjectEqualsPretty(
|
||||
|
|
1
gradle/.gitignore
vendored
Normal file
1
gradle/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.idea
|
1
gradle/core/.gitignore
vendored
Normal file
1
gradle/core/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
out/*
|
57
karma.conf.js
Normal file
57
karma.conf.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
module.exports = function(config) {
|
||||
config.set({
|
||||
browsers: ['ChromeHeadless'],
|
||||
frameworks: ['jasmine', 'closure'],
|
||||
singleRun: true,
|
||||
autoWatch: false,
|
||||
files: [
|
||||
'node_modules/google-closure-library/closure/goog/base.js',
|
||||
'core/build/resources/test/**/*_test.js',
|
||||
{
|
||||
pattern: 'core/build/resources/test/**/!(*_test).js',
|
||||
included: false
|
||||
},
|
||||
{
|
||||
pattern: 'core/build/resources/main/**/*.js',
|
||||
included: false
|
||||
},
|
||||
{
|
||||
pattern: 'core/build/generated/source/custom/main/**/*.soy.js',
|
||||
included: false
|
||||
},
|
||||
{
|
||||
pattern: 'node_modules/soyutils_usegoog.js',
|
||||
included: false
|
||||
},
|
||||
{
|
||||
pattern: 'node_modules/google-closure-library/closure/goog/deps.js',
|
||||
included: false,
|
||||
served: false
|
||||
},
|
||||
{
|
||||
pattern: 'core/build/resources/main/google/registry/ui/assets/images/*.png',
|
||||
included: false,
|
||||
served: true
|
||||
},
|
||||
{
|
||||
pattern: 'core/build/resources/main/google/registry/ui/assets/images/icons/svg/*.svg',
|
||||
included: false,
|
||||
served: true
|
||||
}
|
||||
],
|
||||
preprocessors: {
|
||||
'node_modules/google-closure-library/closure/goog/deps.js': ['closure', 'closure-deps'],
|
||||
'node_modules/google-closure-library/closure/goog/base.js': ['closure'],
|
||||
'node_modules/google-closure-library/closure/**/*.js': ['closure'],
|
||||
'core/build/resources/test/**/*_test.js': ['closure'],
|
||||
'core/build/resources/test/**/!(*_test).js': ['closure'],
|
||||
'core/build/resources/main/**/*.js': ['closure'],
|
||||
'core/build/generated/source/custom/main/**/*.soy.js': ['closure'],
|
||||
'node_modules/soyutils_usegoog.js': ['closure']
|
||||
},
|
||||
proxies: {
|
||||
"/assets/": "/base/core/build/resources/main/google/registry/ui/assets/"
|
||||
}
|
||||
});
|
||||
};
|
||||
|
3272
package-lock.json
generated
3272
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -18,5 +18,12 @@
|
|||
"homepage": "https://github.com/google/nomulus#readme",
|
||||
"dependencies": {
|
||||
"google-closure-library": "20190325.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jasmine-core": "^3.3.0",
|
||||
"karma": "~0.13",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-closure": "^0.1.3",
|
||||
"karma-jasmine": "^2.0.1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue