<commit_before>"use strict";

define(
		[	'src/testUtils',
			'src/Iterator',
			'src/propertyPanel',
			'src/Schema',
			'src/schemaOptions',
			'src/dataInstance',
			'src/ViewController'
		],
		function (
			CSLEDIT_testUtils,
			CSLEDIT_Iterator,
			CSLEDIT_propertyPanel,
			CSLEDIT_Schema,
			CSLEDIT_schemaOptions,
			CSLEDIT_data,
			CSLEDIT_ViewController
		) {
	module("Create view for all nodes in top styles");

	asyncTest("setup views for all popular styles", function () {
		var styles = CSLEDIT_testUtils.getStyles(40),
			fakeDropdownMenuHandler = function () {},
			fakeSyntaxHighlighter = {
				selectedNodeChanged : function () {}
			},
			updates;

		window.CSLEDIT_schema = CSLEDIT_Schema(CSLEDIT_schemaOptions);
		CSLEDIT_schema.callWhenReady( function () {
			ok(true, "schema loaded");

			CSLEDIT_data.setCslCode(styles[Object.keys(styles)[0]]);

			window.CSLEDIT_viewController = CSLEDIT_ViewController(
				$('<div/>'), $('<div/>'), $('<div/>'), $('<div/>'),
				fakeSyntaxHighlighter
			);
			
			CSLEDIT_data.addViewController(CSLEDIT_viewController);
			
			CSLEDIT_viewController.init(CSLEDIT_data.get(), {
				formatCitations : function () { 
					processNextStyle();
				},
				//deleteNode : function () {},
				//moveNode : function () {},
				//checkMove : function () {},
				viewInitialised : function () {}
			});
		});

		var processNextStyle = function () {
			var result,
				styleUrl,
				styleCode,
				title;

			$.each(styles, function (url, cslCode) {
				styleUrl = url;
				styleCode = cslCode;
				return false;
			});

			if (typeof(styleUrl) === "undefined") {
				start(); // finish this test
				return;
			}

			delete styles[styleUrl];

			result = CSLEDIT_data.setCslCode(styleCode);

			if ("error" in result) {
				// should only get dependent style errors in repo styles
				ok(result.error.indexOf("dependent style") !== -1, "dependent style: " + styleUrl);
				processNextStyle();
			} else {
				title = CSLEDIT_data.getNodesFromPath("style/info/title")[0].textValue;
				ok(true, "processing style " + title);
			}
		};
	});
});
<commit_msg>fix integration tests after recent error reporting change<commit_after>"use strict";

define(
		[	'src/testUtils',
			'src/Iterator',
			'src/propertyPanel',
			'src/Schema',
			'src/schemaOptions',
			'src/dataInstance',
			'src/ViewController'
		],
		function (
			CSLEDIT_testUtils,
			CSLEDIT_Iterator,
			CSLEDIT_propertyPanel,
			CSLEDIT_Schema,
			CSLEDIT_schemaOptions,
			CSLEDIT_data,
			CSLEDIT_ViewController
		) {
	module("Create view for all nodes in top styles");

	asyncTest("setup views for all popular styles", function () {
		var styles = CSLEDIT_testUtils.getStyles(40),
			fakeDropdownMenuHandler = function () {},
			fakeSyntaxHighlighter = {
				selectedNodeChanged : function () {}
			},
			updates;

		window.CSLEDIT_schema = CSLEDIT_Schema(CSLEDIT_schemaOptions);
		CSLEDIT_schema.callWhenReady( function () {
			ok(true, "schema loaded");

			CSLEDIT_data.setCslCode(styles[Object.keys(styles)[0]]);

			window.CSLEDIT_viewController = CSLEDIT_ViewController(
				$('<div/>'), $('<div/>'), $('<div/>'), $('<div/>'),
				fakeSyntaxHighlighter
			);
			
			CSLEDIT_data.addViewController(CSLEDIT_viewController);
			
			CSLEDIT_viewController.init(CSLEDIT_data.get(), {
				formatCitations : function () { 
					processNextStyle();
				},
				//deleteNode : function () {},
				//moveNode : function () {},
				//checkMove : function () {},
				viewInitialised : function () {}
			});
		});

		var processNextStyle = function () {
			var result,
				styleUrl,
				styleCode,
				title;

			$.each(styles, function (url, cslCode) {
				styleUrl = url;
				styleCode = cslCode;
				return false;
			});

			if (typeof(styleUrl) === "undefined") {
				start(); // finish this test
				return;
			}

			delete styles[styleUrl];

			result = CSLEDIT_data.setCslCode(styleCode);

			if ("error" in result) {
				// should only get dependent style errors in repo styles
				equal(result.error.type, "dependentStyle", "dependent style: " + styleUrl);
				processNextStyle();
			} else {
				title = CSLEDIT_data.getNodesFromPath("style/info/title")[0].textValue;
				ok(true, "processing style " + title);
			}
		};
	});
});

{'fraction_non_alphanumeric': 0.14430320150659134, 'fraction_numerical': 0.00211864406779661, 'mean_word_length': 3.4868004223864837, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7545128', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1362, 'n_words': 260}