@@ -3,14 +3,19 @@ import { describe, expect, usingHar } from '../../har-fixture'
33// must import fixture **first** for mocks, the `expect` keeps biome from changing sort-order
44expect
55
6+ import type { StrippedLocation } from '@/lib/enhancer'
67import { EnhancerRegistry } from '../../../src/lib/registries'
78
89const enhancers = new EnhancerRegistry ( )
9- function enhancements ( document : Document ) {
10+ function enhancements ( document : Document , window : Window ) {
1011 const textareas = document . querySelectorAll ( 'textarea' )
12+ const location : StrippedLocation = {
13+ domain : window . location . host ,
14+ pathname : window . location . pathname ,
15+ }
1116 const spotsFound = [ ]
1217 for ( const textarea of textareas ) {
13- const enhanced = enhancers . tryToEnhance ( textarea )
18+ const enhanced = enhancers . tryToEnhance ( textarea , location )
1419 const forValue = `id=${ textarea . id } name=${ textarea . name } className=${ textarea . className } `
1520 if ( enhanced ) {
1621 spotsFound . push ( {
@@ -31,7 +36,7 @@ function enhancements(document: Document) {
3136
3237describe ( 'github' , ( ) => {
3338 usingHar ( 'gh_pr' ) . it ( 'should create the correct spot object' , async ( ) => {
34- expect ( enhancements ( document ) ) . toMatchInlineSnapshot ( `
39+ expect ( enhancements ( document , window ) ) . toMatchInlineSnapshot ( `
3540 [
3641 {
3742 "for": "id=feedback name=feedback className=form-control width-full mb-2",
@@ -66,7 +71,7 @@ describe('github', () => {
6671 ` )
6772 } )
6873 usingHar ( 'gh_new_pr' ) . it ( 'should create the correct spot object' , async ( ) => {
69- expect ( enhancements ( document ) ) . toMatchInlineSnapshot ( `
74+ expect ( enhancements ( document , window ) ) . toMatchInlineSnapshot ( `
7075 [
7176 {
7277 "for": "id=feedback name=feedback className=form-control width-full mb-2",
@@ -98,7 +103,7 @@ describe('github', () => {
98103 ` )
99104 } )
100105 usingHar ( 'gh_issue' ) . it ( 'should create the correct spot object' , async ( ) => {
101- expect ( enhancements ( document ) ) . toMatchInlineSnapshot ( `
106+ expect ( enhancements ( document , window ) ) . toMatchInlineSnapshot ( `
102107 [
103108 {
104109 "for": "id=feedback name=feedback className=form-control width-full mb-2",
@@ -108,7 +113,7 @@ describe('github', () => {
108113 ` )
109114 } )
110115 usingHar ( 'gh_new_issue' ) . it ( 'should create the correct spot object' , async ( ) => {
111- expect ( enhancements ( document ) ) . toMatchInlineSnapshot ( `
116+ expect ( enhancements ( document , window ) ) . toMatchInlineSnapshot ( `
112117 [
113118 {
114119 "for": "id=feedback name=feedback className=form-control width-full mb-2 overtype-input",
0 commit comments