- // Walk the front path one step.
- for ( k1 = -d + k1start; k1 <= d - k1end; k1 += 2 ) {
- k1Offset = vOffset + k1;
- if ( k1 === -d || ( k1 !== d && v1[ k1Offset - 1 ] < v1[ k1Offset + 1 ] ) ) {
- x1 = v1[ k1Offset + 1 ];
- } else {
- x1 = v1[ k1Offset - 1 ] + 1;
- }
- y1 = x1 - k1;
- while ( x1 < text1Length && y1 < text2Length &&
- text1.charAt( x1 ) === text2.charAt( y1 ) ) {
- x1++;
- y1++;
- }
- v1[ k1Offset ] = x1;
- if ( x1 > text1Length ) {
- // Ran off the right of the graph.
- k1end += 2;
- } else if ( y1 > text2Length ) {
- // Ran off the bottom of the graph.
- k1start += 2;
- } else if ( front ) {
- k2Offset = vOffset + delta - k1;
- if ( k2Offset >= 0 && k2Offset < vLength && v2[ k2Offset ] !== -1 ) {
- // Mirror x2 onto top-left coordinate system.
- x2 = text1Length - v2[ k2Offset ];
- if ( x1 >= x2 ) {
- // Overlap detected.
- return this.diffBisectSplit( text1, text2, x1, y1, deadline );
- }
- }
- }
- }
+ return false;
+ } );
+
+ return filter;
+}
+
+function toolbarModuleFilterHtml() {
+ var i,
+ moduleFilterHtml = "";
+
+ if ( !modulesList.length ) {
+ return false;
+ }
+
+ moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label>" +
+ "<select id='qunit-modulefilter' name='modulefilter'><option value='' " +
+ ( QUnit.urlParams.module === undefined ? "selected='selected'" : "" ) +
+ ">< All Modules ></option>";
+
+ for ( i = 0; i < modulesList.length; i++ ) {
+ moduleFilterHtml += "<option value='" +
+ escapeText( encodeURIComponent( modulesList[ i ] ) ) + "' " +
+ ( QUnit.urlParams.module === modulesList[ i ] ? "selected='selected'" : "" ) +
+ ">" + escapeText( modulesList[ i ] ) + "</option>";
+ }
+ moduleFilterHtml += "</select>";
+
+ return moduleFilterHtml;
+}
+
+function toolbarModuleFilter() {
+ var toolbar = id( "qunit-testrunner-toolbar" ),
+ moduleFilter = document.createElement( "span" ),
+ moduleFilterHtml = toolbarModuleFilterHtml();
+
+ if ( !toolbar || !moduleFilterHtml ) {
+ return false;
+ }
+
+ moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
+ moduleFilter.innerHTML = moduleFilterHtml;
+
+ addEvent( moduleFilter.lastChild, "change", applyUrlParams );
+
+ toolbar.appendChild( moduleFilter );
+}
+
+function appendToolbar() {
+ var toolbar = id( "qunit-testrunner-toolbar" );
+
+ if ( toolbar ) {
+ toolbar.appendChild( toolbarUrlConfigContainer() );
+ toolbar.appendChild( toolbarLooseFilter() );
+ toolbarModuleFilter();
+ }
+}
+
+function appendHeader() {
+ var header = id( "qunit-header" );
+
+ if ( header ) {
+ header.innerHTML = "<a href='" + escapeText( unfilteredUrl ) + "'>" + header.innerHTML +
+ "</a> ";
+ }
+}
+
+function appendBanner() {
+ var banner = id( "qunit-banner" );
+
+ if ( banner ) {
+ banner.className = "";
+ }
+}
+
+function appendTestResults() {
+ var tests = id( "qunit-tests" ),
+ result = id( "qunit-testresult" );
+
+ if ( result ) {
+ result.parentNode.removeChild( result );
+ }
+
+ if ( tests ) {
+ tests.innerHTML = "";
+ result = document.createElement( "p" );
+ result.id = "qunit-testresult";
+ result.className = "result";
+ tests.parentNode.insertBefore( result, tests );
+ result.innerHTML = "Running...<br /> ";
+ }
+}
+
+function storeFixture() {
+ var fixture = id( "qunit-fixture" );
+ if ( fixture ) {
+ config.fixture = fixture.innerHTML;
+ }
+}
+
+function appendFilteredTest() {
+ var testId = QUnit.config.testId;
+ if ( !testId || testId.length <= 0 ) {
+ return "";
+ }
+ return "<div id='qunit-filteredTest'>Rerunning selected tests: " +
+ escapeText( testId.join( ", " ) ) +
+ " <a id='qunit-clearFilter' href='" +
+ escapeText( unfilteredUrl ) +
+ "'>Run all tests</a></div>";
+}
+
+function appendUserAgent() {
+ var userAgent = id( "qunit-userAgent" );
+
+ if ( userAgent ) {
+ userAgent.innerHTML = "";
+ userAgent.appendChild(
+ document.createTextNode(
+ "QUnit " + QUnit.version + "; " + navigator.userAgent
+ )
+ );
+ }
+}