Skip to content

Commit 7dc9123

Browse files
chore(scoped-custom-elements-registry): address code review by adding tests and updating the CHANGELOG
1 parent 1b9f61f commit 7dc9123

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

packages/scoped-custom-element-registry/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
<!-- ## Unreleased -->
8+
## Unreleased
9+
10+
### Fixed
11+
12+
- Polyfilled ElementInternals prototype methods now return their original value.
913

1014
# [0.0.5] - 2022-02-18
1115

packages/scoped-custom-element-registry/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/scoped-custom-element-registry/test/form-associated.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,22 @@ export const commonRegistryTests = (registry) => {
9999
expect(form.elements.length).to.equal(0);
100100
});
101101
});
102+
103+
describe('ElementInternals prototype method overrides', () => {
104+
it('will still return the appropriate values', () => {
105+
const {tagName, CustomElementClass} = getFormAssociatedTestElement();
106+
registry.define(tagName, CustomElementClass);
107+
108+
const form = document.createElement('form');
109+
const element = new CustomElementClass();
110+
111+
form.append(element);
112+
113+
expect(element.internals.checkValidity()).to.be.true;
114+
115+
element.internals.setValidity({valueMissing: true}, 'Test');
116+
117+
expect(element.internals.checkValidity()).to.be.false;
118+
});
119+
});
102120
};

0 commit comments

Comments
 (0)