@@ -56,6 +56,11 @@ describe('GamepadHelper', () => {
5656 expect ( helper . vendorProductLookup [ '054c:0ce6' ] . name ) . toBe ( 'Sony DualSense (PS5)' ) ;
5757 expect ( helper . vendorProductLookup [ '057e:2009' ] . name ) . toBe ( 'Nintendo Switch Pro Controller' ) ;
5858 expect ( helper . vendorProductLookup [ '1209:0001' ] . name ) . toBe ( 'Generic Gamepad' ) ;
59+ expect ( helper . vendorProductLookup [ '045e:028e' ] . name ) . toBe ( 'Xbox 360' ) ;
60+ expect ( helper . vendorProductLookup [ '045e:02ea' ] . name ) . toBe ( 'Xbox One/Series' ) ;
61+ expect ( helper . vendorProductLookup [ '045e:0b12' ] . name ) . toBe ( 'Xbox One/Series' ) ;
62+ expect ( helper . vendorProductLookup [ '045e:0b13' ] . name ) . toBe ( 'Xbox One/Series' ) ;
63+ expect ( helper . vendorProductLookup [ '045e:0b20' ] . name ) . toBe ( 'Xbox One/Series' ) ;
5964 } ) ;
6065
6166 test ( 'initializes controller mappings correctly' , ( ) => {
@@ -130,6 +135,18 @@ describe('GamepadHelper', () => {
130135 type : 'standard' ,
131136 name : 'Generic Gamepad'
132137 } ,
138+ {
139+ browserController : 'Firefox Xbox 360' ,
140+ gamepadId : '045e-028e-Sunshine (libvirtualhid) X-Box 360 Controller' ,
141+ type : 'xbox' ,
142+ name : 'Xbox 360'
143+ } ,
144+ {
145+ browserController : 'Firefox Xbox Series' ,
146+ gamepadId : '045e-0b13-Sunshine (libvirtualhid) X-Box Series Controller' ,
147+ type : 'xbox' ,
148+ name : 'Xbox One/Series'
149+ } ,
133150 {
134151 browserController : 'Chrome DualShock 4' ,
135152 gamepadId : 'HID VHF Driver (STANDARD GAMEPAD Vendor: 054c Product: 05c4)' ,
@@ -154,6 +171,24 @@ describe('GamepadHelper', () => {
154171 type : 'standard' ,
155172 name : 'Generic Gamepad'
156173 } ,
174+ {
175+ browserController : 'Chrome Xbox 360' ,
176+ gamepadId : 'Sunshine (libvirtualhid) X-Box 360 Controller (STANDARD GAMEPAD Vendor: 045e Product: 028e)' ,
177+ type : 'xbox' ,
178+ name : 'Xbox 360'
179+ } ,
180+ {
181+ browserController : 'Chrome Xbox One' ,
182+ gamepadId : 'Sunshine (libvirtualhid) X-Box One Controller (STANDARD GAMEPAD Vendor: 045e Product: 0b20)' ,
183+ type : 'xbox' ,
184+ name : 'Xbox One/Series'
185+ } ,
186+ {
187+ browserController : 'Chrome Xbox Series' ,
188+ gamepadId : 'Sunshine (libvirtualhid) X-Box Series Controller (STANDARD GAMEPAD Vendor: 045e Product: 0b13)' ,
189+ type : 'xbox' ,
190+ name : 'Xbox One/Series'
191+ } ,
157192 ] ) ( 'returns a VID/PID match for $browserController' , ( { gamepadId, type, name } ) => {
158193 expect ( helper . getGamepadInfo ( gamepadId ) ) . toEqual ( { type, name } ) ;
159194 } ) ;
@@ -201,6 +236,8 @@ describe('GamepadHelper', () => {
201236 expect ( helper . getButtonName ( helper . CONTROLLER_TYPES . XBOX , 0 ) ) . toBe ( 'A' ) ;
202237 expect ( helper . getButtonName ( helper . CONTROLLER_TYPES . XBOX , 4 ) ) . toBe ( 'LB' ) ;
203238 expect ( helper . getButtonName ( helper . CONTROLLER_TYPES . XBOX , 12 ) ) . toBe ( 'DUp' ) ;
239+ expect ( helper . getButtonName ( helper . CONTROLLER_TYPES . XBOX , 17 ) ) . toBe ( 'Share' ) ;
240+ expect ( helper . getButtonName ( helper . CONTROLLER_TYPES . XBOX , 18 ) ) . toBe ( 'B18' ) ;
204241 } ) ;
205242
206243 test ( 'returns correct button names for PlayStation controller' , ( ) => {
@@ -393,6 +430,11 @@ describe('GamepadHelper', () => {
393430 expect ( path ) . toBe ( '/assets/img/gamepads/xbox/Buttons Outline/White/SVG/A.svg' ) ;
394431 } ) ;
395432
433+ test ( 'returns the Share icon for Xbox button 17' , ( ) => {
434+ const path = helper . getButtonImagePath ( helper . CONTROLLER_TYPES . XBOX , 17 ) ;
435+ expect ( path ) . toBe ( '/assets/img/gamepads/xbox/Buttons Outline/White/SVG/Share.svg' ) ;
436+ } ) ;
437+
396438 test ( 'returns correct path for PlayStation controller buttons' , ( ) => {
397439 const path = helper . getButtonImagePath ( helper . CONTROLLER_TYPES . PLAYSTATION , 3 ) ;
398440 expect ( path ) . toBe ( '/assets/img/gamepads/playstation/Buttons Outline/White/SVG/Triangle.svg' ) ;
0 commit comments