Properly expose errors in ads and tests (#8692)

* add code to expose errors outside zone

* remove unexpect error hiding

* remove uncessary code

* fix tests

* trying to catch more errros

* revert for testing

* wip

* wip

* figured out what was going on

* wip

* fix tests

* fix tests
This commit is contained in:
Anthony Dresser
2019-12-17 12:06:36 -08:00
committed by GitHub
parent 6b5c31410d
commit ea5f9be441
29 changed files with 483 additions and 790 deletions

View File

@@ -64,7 +64,7 @@ suite('ComponentBase Tests', () => {
testContainer = new TestContainer(modelStore, 'testContainer');
});
test('Component validation runs external validations stored in the model store', done => {
test('Component validation runs external validations stored in the model store', () => {
assert.equal(testComponent.valid, true, 'Test component validity did not default to true');
let validationCalls = 0;
modelStore.registerValidationCallback(componentId => {
@@ -72,19 +72,14 @@ suite('ComponentBase Tests', () => {
return Promise.resolve(false);
});
testComponent.validate().then(valid => {
try {
assert.equal(validationCalls, 1, 'External validation was not called once');
assert.equal(valid, false, 'Validate call did not return correct value from the external validation');
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
done();
} catch (err) {
done(err);
}
}, err => done(err));
return testComponent.validate().then(valid => {
assert.equal(validationCalls, 1, 'External validation was not called once');
assert.equal(valid, false, 'Validate call did not return correct value from the external validation');
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
});
});
test('Component validation runs default component validations', done => {
test('Component validation runs default component validations', () => {
assert.equal(testComponent.valid, true, 'Test component validity did not default to true');
let validationCalls = 0;
testComponent.addValidation(() => {
@@ -92,29 +87,23 @@ suite('ComponentBase Tests', () => {
return false;
});
testComponent.validate().then(valid => {
try {
assert.equal(validationCalls, 1, 'Default validation was not called once');
assert.equal(valid, false, 'Validate call did not return correct value from the default validation');
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
done();
} catch (err) {
done(err);
}
}, err => done(err));
return testComponent.validate().then(valid => {
assert.equal(validationCalls, 1, 'Default validation was not called once');
assert.equal(valid, false, 'Validate call did not return correct value from the default validation');
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
});
});
test('Container validation reflects child component validity', done => {
test('Container validation reflects child component validity', () => {
assert.equal(testContainer.valid, true, 'Test container validity did not default to true');
testContainer.addToContainer(testComponent.descriptor, undefined);
testComponent.addValidation(() => false);
testComponent.validate().then(() => {
testContainer.validate().then(valid => {
return testComponent.validate().then(() => {
return testContainer.validate().then(valid => {
assert.equal(valid, false, 'Validate call did not return correct value for container child validation');
assert.equal(testContainer.valid, false, 'Validate call did not update the container valid property');
done();
}, err => done(err));
}, err => done(err));
});
});
});
test('Container child validity changes cause the parent container validity to change', done => {