File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed
dev/tests/js/jasmine/tests/lib/mage/adminhtml Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change 11/**
2- * Copyright 2014 Adobe
2+ * Copyright 2025 Adobe
33 * All Rights Reserved.
44 */
55
@@ -47,6 +47,33 @@ define([
4747 if ( window . Event ) {
4848 window . Event . observe = function ( ) { } ;
4949 }
50+ // Stub Prototype's $ to return a fake target implementing up().select() chain
51+ var originalDollar = window . $ ;
52+ var fakeTarget = {
53+ id : 'test_input_dependent' ,
54+ type : 'input' ,
55+ tagName : 'INPUT' ,
56+ getAttribute : function ( ) {
57+ return null ;
58+ } ,
59+ show : function ( ) { } ,
60+ hide : function ( ) { } ,
61+ up : function ( ) {
62+ return {
63+ show : function ( ) { } ,
64+ hide : function ( ) { } ,
65+ select : function ( ) {
66+ return [ cssDisabled , normalInput ] ;
67+ }
68+ } ;
69+ }
70+ } ;
71+ window . $ = function ( id ) {
72+ if ( id === 'test_input_dependent' ) {
73+ return fakeTarget ;
74+ }
75+ return document . getElementById ( id ) ;
76+ } ;
5077 /* eslint-disable no-new */
5178 new window . FormElementDependenceController ( {
5279 'test_input_dependent' : {
@@ -66,6 +93,9 @@ define([
6693 if ( window . Event && originalObserve ) {
6794 window . Event . observe = originalObserve ;
6895 }
96+ if ( originalDollar ) {
97+ window . $ = originalDollar ;
98+ }
6999 document . body . removeChild ( container ) ;
70100 document . body . removeChild ( source ) ;
71101 } ) ;
You can’t perform that action at this time.
0 commit comments