@@ -7,6 +7,18 @@ const { isNativeElement, ELEMENT_TAGS } = require('../../../lib/utils/is-native-
77// for-html-elements.js and siblings) because it requires a real ESLint
88// SourceCode / scope manager that's only built up by the rule tester.
99
10+ // Stub a minimal ESLint-shaped sourceCode object. The real one uses scope
11+ // managers produced by ember-eslint-parser; for unit-level coverage we mock
12+ // just the surface `isNativeElement` touches: `getScope(parent)` returning
13+ // an object with `variables` (bindings) and `upper` (parent scope).
14+ function stubSourceCode ( scopeByParent ) {
15+ return {
16+ getScope ( parent ) {
17+ return scopeByParent . get ( parent ) || { variables : [ ] , upper : null } ;
18+ } ,
19+ } ;
20+ }
21+
1022describe ( 'isNativeElement — list-only behavior (no sourceCode)' , ( ) => {
1123 it ( 'returns true for lowercase HTML tag names' , ( ) => {
1224 expect ( isNativeElement ( { tag : 'div' } ) ) . toBe ( true ) ;
@@ -80,18 +92,9 @@ describe('isNativeElement — list-only behavior (no sourceCode)', () => {
8092} ) ;
8193
8294describe ( 'isNativeElement — scope-shadowing (with sourceCode stubs)' , ( ) => {
83- // Stub a minimal ESLint-shaped sourceCode object. The real one uses
84- // scope managers produced by ember-eslint-parser; for unit-level coverage
85- // we mock just the surface `isNativeElement` touches: `getScope(parent)`
86- // returning an object with `variables` (bindings) and `upper` (parent
87- // scope). Rule-level integration tests cover the real parser's shape.
88- function stubSourceCode ( scopeByParent ) {
89- return {
90- getScope ( parent ) {
91- return scopeByParent . get ( parent ) || { variables : [ ] , upper : null } ;
92- } ,
93- } ;
94- }
95+ // Rule-level integration tests (tests/lib/rules/...) cover the real
96+ // parser's shape; here we mock the minimal surface `isNativeElement`
97+ // touches via `stubSourceCode` above.
9598
9699 it ( 'treats a tag as shadowed when its name matches an actual binding' , ( ) => {
97100 const parent = { type : 'Template' } ;
0 commit comments