<commit_before>/*
 * mobile dialog unit tests
 */
(function($) {
	module( "jquery.mobile.dialog.js", {
		setup: function() {
			$.mobile.page.prototype.options.contentTheme = "d";
		}
	});

	asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() {
		expect( 2 );

		$.testHelper.pageSequence([
			function() {
				$.mobile.changePage( $( "#mypage" ) );
			},

			function() {
				//bring up the dialog
				$( "#foo-dialog-link" ).click();
			},

			function() {
				var fooDialog = $( "#foo-dialog" );

				// make sure the dialog came up
				ok( /&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open" );

				// close the dialog
				$( ".ui-dialog" ).dialog( "close" );
			},

			function() {
				ok( !/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash" );
				start();
			}
		]);
	});

	asyncTest( "clicking dialog 'Close' button twice in quick succession does not cause the browser history to retreat by two", function() {
		var correctLocation;
<commit_msg>[dialog unit tests] Add expect() to the double-close test<commit_after>/*
 * mobile dialog unit tests
 */
(function($) {
	module( "jquery.mobile.dialog.js", {
		setup: function() {
			$.mobile.page.prototype.options.contentTheme = "d";
		}
	});

	asyncTest( "dialog hash is added when the dialog is opened and removed when closed", function() {
		expect( 2 );

		$.testHelper.pageSequence([
			function() {
				$.mobile.changePage( $( "#mypage" ) );
			},

			function() {
				//bring up the dialog
				$( "#foo-dialog-link" ).click();
			},

			function() {
				var fooDialog = $( "#foo-dialog" );

				// make sure the dialog came up
				ok( /&ui-state=dialog/.test(location.hash), "ui-state=dialog =~ location.hash", "dialog open" );

				// close the dialog
				$( ".ui-dialog" ).dialog( "close" );
			},

			function() {
				ok( !/&ui-state=dialog/.test(location.hash), "ui-state=dialog !~ location.hash" );
				start();
			}
		]);
	});

	asyncTest( "clicking dialog 'Close' button twice in quick succession does not cause the browser history to retreat by two", function() {
		var correctLocation;

		expect(3);

{'fraction_non_alphanumeric': 0.1763085399449036, 'fraction_numerical': 0.0013774104683195593, 'mean_word_length': 3.0652985074626864, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1346847', 'n_tokens_mistral': 814, 'n_tokens_neox': 678, 'n_words': 189}