mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	make $constants, $strings, and utility functions avaiable to Cypress mounted componenets
This commit is contained in:
		
							parent
							
								
									a49c5afa46
								
							
						
					
					
						commit
						9b332f0e66
					
				@ -16,13 +16,23 @@ import '../../assets/app.css'
 | 
				
			|||||||
import './tailwind.compiled.css'
 | 
					import './tailwind.compiled.css'
 | 
				
			||||||
// Import commands.js using ES2015 syntax:
 | 
					// Import commands.js using ES2015 syntax:
 | 
				
			||||||
import './commands'
 | 
					import './commands'
 | 
				
			||||||
 | 
					import Vue from 'vue'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Alternatively you can use CommonJS syntax:
 | 
					import { Constants } from '../../plugins/constants'
 | 
				
			||||||
// require('./commands')
 | 
					import Strings from '../../strings/en-us.json'
 | 
				
			||||||
 | 
					import '../../plugins/utils'
 | 
				
			||||||
 | 
					import '../../plugins/init.client'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { mount } from 'cypress/vue2'
 | 
					import { mount } from 'cypress/vue2'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Cypress.Commands.add('mount', mount)
 | 
					//Cypress.Commands.add('mount', mount)
 | 
				
			||||||
 | 
					Cypress.Commands.add('mount', (component, options = {}) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Vue.prototype.$constants = Constants
 | 
				
			||||||
 | 
					  Vue.prototype.$strings = Strings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return mount(component, options)
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Example use:
 | 
					// Example use:
 | 
				
			||||||
// cy.mount(MyComponent)
 | 
					// cy.mount(MyComponent)
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user