mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
b4850f2ee4
The idl definition for Event makes the properties constant this means that they shouldn't be configurable and writable. However, they were, and this commit fixes that. Fixes: https://github.com/nodejs/node/issues/50417 PR-URL: https://github.com/nodejs/node/pull/50425 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
22 lines
713 B
JavaScript
22 lines
713 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
const eventPhases = {
|
|
'NONE': 0,
|
|
'CAPTURING_PHASE': 1,
|
|
'AT_TARGET': 2,
|
|
'BUBBLING_PHASE': 3
|
|
};
|
|
|
|
for (const [prop, value] of Object.entries(eventPhases)) {
|
|
// Check if the value of the property matches the expected value
|
|
assert.strictEqual(Event[prop], value, `Expected Event.${prop} to be ${value}, but got ${Event[prop]}`);
|
|
|
|
const desc = Object.getOwnPropertyDescriptor(Event, prop);
|
|
assert.strictEqual(desc.writable, false, `${prop} should not be writable`);
|
|
assert.strictEqual(desc.configurable, false, `${prop} should not be configurable`);
|
|
assert.strictEqual(desc.enumerable, true, `${prop} should be enumerable`);
|
|
}
|