<commit_before>/*!
 * ${copyright}
 */

/*global QUnit, Date:true */

/**
 * SAPUI5 test utilities
 *
 * @namespace
 * @name sap.ui.test
 * @public
 */

sap.ui.define('sap/ui/qunit/QUnitUtils', ['jquery.sap.global', 'sap/ui/Device'],
	function(jQuery, Device) {
	"use strict";

	if ( typeof QUnit !== 'undefined' ) {

		// extract the URL parameters
		var mParams = jQuery.sap.getUriParameters();
		
		// TODO: Remove deprecated code once all projects adapted
		QUnit.equals = window.equals = window.equal;

		// Set global timeout for all tests
		var sTimeout = mParams.get("sap-ui-qunittimeout");
		if (!sTimeout || isNaN(sTimeout)) {
			sTimeout = "30000"; // 30s: default timeout of an individual QUnit test!
		}
		QUnit.config.testTimeout = parseInt(sTimeout, 10);
		
		// Do not reorder tests, as most of the tests depend on each other
		QUnit.config.reorder = false;
		
		// only when instrumentation is done on server-side blanket itself doesn't
		// take care about rendering the report - in this case we do it manually
		// when the URL parameter "coverage-report" is set to true or x
		if (window["sap-ui-qunit-coverage"] !== "client" && /x|true/i.test(jQuery.sap.getUriParameters().get("coverage-report"))) {
			QUnit.done(function(failures, total) {
				// only when coverage is available and modern browser (not IE8!)
				if (window._$blanket && document.addEventListener) {
					// we remove the QUnit object to avoid blanket to automatically
					// trigger start on QUnit which leads to failures in qunit-junit-reporter
					var QUnit = window.QUnit;
					window.QUnit = undefined;
					// load the blanket instance
					jQuery.sap.require("sap.ui.thirdparty.blanket");
					// reset the QUnit object 
					window.QUnit = QUnit;
					// trigger blanket to display the coverage report
					window.blanket.report({});
				}
			});
		}
	
	}
	
	// PhantomJS patch for Focus detection via jQuery:
	// ==> https://code.google.com/p/phantomjs/issues/detail?id=427
	//     ==> https://github.com/ariya/phantomjs/issues/10427
	if (Device.browser.phantomJS) {
		// workaround copied from above bug report
		var $is = jQuery.fn.is;
		jQuery.fn.is = function(sSelector) {
			if (sSelector === ":focus") {
				return this.get(0) === document.activeElement;
			}
			return $is.apply(this, arguments);
		};
	}
	
	// PhantomJS fix for invalid date handling:
	// ==> https://github.com/ariya/phantomjs/issues/11151
	if (Device.browser.phantomJS) {
		<commit_msg>[INTERNAL] QUnitUtils: generic fix for the IE9 sinon XHR issue<commit_after>/*!
 * ${copyright}
 */

/*global QUnit, Date:true */

/**
 * SAPUI5 test utilities
 *
 * @namespace
 * @name sap.ui.test
 * @public
 */

sap.ui.define('sap/ui/qunit/QUnitUtils', ['jquery.sap.global', 'sap/ui/Device'],
	function(jQuery, Device) {
	"use strict";

	if ( typeof QUnit !== 'undefined' ) {

		// extract the URL parameters
		var mParams = jQuery.sap.getUriParameters();
		
		// TODO: Remove deprecated code once all projects adapted
		QUnit.equals = window.equals = window.equal;

		// Set global timeout for all tests
		var sTimeout = mParams.get("sap-ui-qunittimeout");
		if (!sTimeout || isNaN(sTimeout)) {
			sTimeout = "30000"; // 30s: default timeout of an individual QUnit test!
		}
		QUnit.config.testTimeout = parseInt(sTimeout, 10);
		
		// Do not reorder tests, as most of the tests depend on each other
		QUnit.config.reorder = false;
		
		// only when instrumentation is done on server-side blanket itself doesn't
		// take care about rendering the report - in this case we do it manually
		// when the URL parameter "coverage-report" is set to true or x
		if (window["sap-ui-qunit-coverage"] !== "client" && /x|true/i.test(jQuery.sap.getUriParameters().get("coverage-report"))) {
			QUnit.done(function(failures, total) {
				// only when coverage is available and modern browser (not IE8!)
				if (window._$blanket && document.addEventListener) {
					// we remove the QUnit object to avoid blanket to automatically
					// trigger start on QUnit which leads to failures in qunit-junit-reporter
					var QUnit = window.QUnit;
					window.QUnit = undefined;
					// load the blanket instance
					jQuery.sap.require("sap.ui.thirdparty.blanket");
					// reset the QUnit object 
					window.QUnit = QUnit;
					// trigger blanket to display the coverage report
					window.blanket.report({});
				}
			});
		}
	
	}

	// Enables CORS support for XHR in case of IE9 to avoid XDomainRequest usage
	// TODO: remove this workaround for IE9
	if (Device.browser.internet_explorer && Device.browser.version == 9) {
		QUnit.begin(function() {
			if (window.sinon && window.sinon.xhr) {
				// https://github.com/sinonjs/sinon/issues/732
				window.sinon.xhr.supportsCORS = true;
			}
		});
	}

	// PhantomJS patch for Focus detection via jQuery:
	// ==> https://code.google.com/p/phantomjs/issues/detail?id=427
	//     ==> https://github.com/ariya/phantomjs/issues/10427
	if (Device.browser.phantomJS) {
		// workaround copied from above bug report
		var $is = jQuery.fn.is;
		jQuery.fn.is = function(sSelector) {
			if (sSelector === ":focus") {
				return this.get(0) === document.activeElement;
			}
			return $is.apply(this, arguments);
		};
	}
	
	// PhantomJS fix for invalid date handling:
	// ==> https://github.com/ariya/phantomjs/issues/11151
	if (Device.browser.phantomJS) {
		
{'fraction_non_alphanumeric': 0.1348062160644074, 'fraction_numerical': 0.010672158771765586, 'mean_word_length': 3.1571984435797664, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '126227', 'n_tokens_mistral': 1936, 'n_tokens_neox': 1685, 'n_words': 475}