You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add missing standards for building components (#22412)
* docs: add missing standards for building components
* Naming conventions for the selectors of components & directives
* The tests & public APIs for MDC components should mirror the non-MDC version
* Public properties should use coercion
* fixup! docs: add missing standards for building components
* fixup! docs: add missing standards for building components
* fixup! docs: add missing standards for building components
(cherry picked from commit 60946cc)
Copy file name to clipboardExpand all lines: CODING_STANDARDS.md
+92Lines changed: 92 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -244,12 +244,86 @@ activateRipple() {
244
244
}
245
245
```
246
246
247
+
##### Selectors
248
+
* Component selectors should be lowercase and delimited by hyphens. Components should use element
249
+
selectors except when the component API uses a native HTML element.
250
+
* Directive selectors should be camel cased. Exceptions may be made for directives that act like a
251
+
component but would have an empty template, or when the directive is intended to match some
252
+
existing attribute.
253
+
247
254
#### Inheritance
248
255
249
256
Avoid using inheritance to apply reusable behaviors to multiple components. This limits how many
250
257
behaviors can be composed. Instead, [TypeScript mixins][ts-mixins] can be used to compose multiple
251
258
common behaviors into a single component.
252
259
260
+
#### MDC checks
261
+
To ensure backwards compatability, we check that tests written for MDC Components include all of
262
+
the same tests that the non-MDC version had. Similarly, we check that the public API of MDC
263
+
Components match that of the non-MDC version.
264
+
265
+
In the case where old tests no longer make sense and should be omitted or the public API should be
266
+
changed, you can do so in [scripts/check-mdc-tests-config.ts](https://github.com/angular/components/blob/master/scripts/check-mdc-tests-config.ts) and
0 commit comments