forked from EVOgeek/Vmeda.Online
		
	MDL-67728 behat: Improve behat app selectors
This commit is contained in:
		
							parent
							
								
									39d10d142e
								
							
						
					
					
						commit
						1f04f85599
					
				@ -72,7 +72,7 @@
 | 
				
			|||||||
        if (window.M.util.pending_js.length === 1) {
 | 
					        if (window.M.util.pending_js.length === 1) {
 | 
				
			||||||
            runAfterEverything(function() {
 | 
					            runAfterEverything(function() {
 | 
				
			||||||
                // Check there isn't a spinner...
 | 
					                // Check there isn't a spinner...
 | 
				
			||||||
                updateSpinner();
 | 
					                checkUIBlocked();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // Only remove it if the pending array is STILL empty after all that.
 | 
					                // Only remove it if the pending array is STILL empty after all that.
 | 
				
			||||||
                if (window.M.util.pending_js.length === 1) {
 | 
					                if (window.M.util.pending_js.length === 1) {
 | 
				
			||||||
@ -109,23 +109,23 @@
 | 
				
			|||||||
        return realOpen.apply(this, arguments);
 | 
					        return realOpen.apply(this, arguments);
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var waitingSpinner = false;
 | 
					    var waitingBlocked = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Checks if a loading spinner is present and visible; if so, adds it to the pending array
 | 
					     * Checks if a loading spinner is present and visible; if so, adds it to the pending array
 | 
				
			||||||
     * (and if not, removes it).
 | 
					     * (and if not, removes it).
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    var updateSpinner = function() {
 | 
					    var checkUIBlocked = function() {
 | 
				
			||||||
        var spinner = document.querySelector('span.core-loading-spinner');
 | 
					        var blocked = document.querySelector('span.core-loading-spinner, ion-loading, .click-block-active');
 | 
				
			||||||
        if (spinner && spinner.offsetParent) {
 | 
					        if (blocked && blocked.offsetParent) {
 | 
				
			||||||
            if (!waitingSpinner) {
 | 
					            if (!waitingBlocked) {
 | 
				
			||||||
                addPending('spinner');
 | 
					                addPending('blocked');
 | 
				
			||||||
                waitingSpinner = true;
 | 
					                waitingBlocked = true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            if (waitingSpinner) {
 | 
					            if (waitingBlocked) {
 | 
				
			||||||
                removePending('spinner');
 | 
					                removePending('blocked');
 | 
				
			||||||
                waitingSpinner = false;
 | 
					                waitingBlocked = false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
@ -167,7 +167,7 @@
 | 
				
			|||||||
            setTimeout(pollRecentMutation, 500);
 | 
					            setTimeout(pollRecentMutation, 500);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // Also update the spinner presence if needed.
 | 
					        // Also update the spinner presence if needed.
 | 
				
			||||||
        updateSpinner();
 | 
					        checkUIBlocked();
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Set listener using the mutation callback.
 | 
					    // Set listener using the mutation callback.
 | 
				
			||||||
@ -182,7 +182,9 @@
 | 
				
			|||||||
     * @param {function} process Callback function that handles each matched node
 | 
					     * @param {function} process Callback function that handles each matched node
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    var findPossibleMatches = function(xpath, process) {
 | 
					    var findPossibleMatches = function(xpath, process) {
 | 
				
			||||||
        var matches = document.evaluate(xpath, document);
 | 
					        var select = 'ion-alert, ion-popover, ion-action-sheet, core-ion-tab.show-tab ion-page.show-page, ion-page.show-page, html';
 | 
				
			||||||
 | 
					        var parent = document.querySelector(select);
 | 
				
			||||||
 | 
					        var matches = document.evaluate(xpath, parent || document);
 | 
				
			||||||
        while (true) {
 | 
					        while (true) {
 | 
				
			||||||
            var match = matches.iterateNext();
 | 
					            var match = matches.iterateNext();
 | 
				
			||||||
            if (!match) {
 | 
					            if (!match) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user