<commit_before>﻿/**
 * FROM:  https://github.com/yearofmoo/ngMidwayTester
 *
 * Creates an instance of the midway tester on the specified module. 
 * 
 * @class ngMidwayTester
 * @constructor
 * @param moduleName the AngularJS module that you wish to test
 * @param {Object} [config]
 * @param {Object} [config.window=window] The window node of the page
 * @param {Object} [config.document=document] The document node of the page
 * @param {Object} [config.templateUrl] The template file for the HTML layout of the tester
 * @param {Object} [config.template] The template string for the HTML layout of the tester
 * @param {Object} [config.mockLocationPaths=true] Whether or not to fake the URL change in the browser address bar
 * @return {Object} An instance of the midway tester
 */
; var ngMidwayTester = function (moduleName, options) {

    options = options || {};
    var doc = options.document || document;
    var wind = options.window || window;
    var noop = angular.noop;

    var mockLocationPaths = options.mockLocationPaths == null ? true : !!options.mockLocationPaths;

    var $rootElement = angular.element(doc.createElement('div')),
        $timers = [],
        $viewContainer,
        $terminalElement,
        $viewCounter = 0;

    var viewSelector = 'ng-view, [ng-view], .ng-view, [x-ng-view], [data-ng-view]';

    var midwayModule = angular.module('ngMidway', []);

    if (mockLocationPaths) {
        midwayModule.config(function ($provide) {
            $provide.decorator('$location', ['$delegate', '$rootScope', function ($delegate, $rootScope) {
                var _path = $delegate.path();
                $delegate.path = function (path) {
                    if (path) {
                        _path = path;
                        $rootScope.$broadcast('$locationChangeSuccess', path);<commit_msg>guard against infinite path-change-broadcast loop<commit_after>﻿/**
 * FROM:  https://github.com/yearofmoo/ngMidwayTester
 *
 * Creates an instance of the midway tester on the specified module. 
 * 
 * @class ngMidwayTester
 * @constructor
 * @param moduleName the AngularJS module that you wish to test
 * @param {Object} [config]
 * @param {Object} [config.window=window] The window node of the page
 * @param {Object} [config.document=document] The document node of the page
 * @param {Object} [config.templateUrl] The template file for the HTML layout of the tester
 * @param {Object} [config.template] The template string for the HTML layout of the tester
 * @param {Object} [config.mockLocationPaths=true] Whether or not to fake the URL change in the browser address bar
 * @return {Object} An instance of the midway tester
 */
; var ngMidwayTester = function (moduleName, options) {

    options = options || {};
    var doc = options.document || document;
    var wind = options.window || window;
    var noop = angular.noop;

    var mockLocationPaths = options.mockLocationPaths == null ? true : !!options.mockLocationPaths;

    var $rootElement = angular.element(doc.createElement('div')),
        $timers = [],
        $viewContainer,
        $terminalElement,
        $viewCounter = 0;

    var viewSelector = 'ng-view, [ng-view], .ng-view, [x-ng-view], [data-ng-view]';

    var midwayModule = angular.module('ngMidway', []);

    if (mockLocationPaths) {
        midwayModule.config(function ($provide) {
            $provide.decorator('$location', ['$delegate', '$rootScope', function ($delegate, $rootScope) {
                var _path = $delegate.path();
                $delegate.path = function (path) {
                    if (path) {
                        // sometimes the broadcast triggers a new request for same path
                        // added this conditional to mitigate risk of this infinite loop
                        if (_path !== path) {
                            _path = path;
                            $rootScope.$broadcast('$locationChangeSuccess', path);                           
                        }
{'fraction_non_alphanumeric': 0.11492238357536304, 'fraction_numerical': 0.000500751126690035, 'mean_word_length': 2.7197392923649906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '7415434', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1049, 'n_words': 350}