<commit_before>﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>UI Helper Method Tests</title>
		<link href="../Common/styles.css" type="text/css" rel="stylesheet" />
		<script src="../Scripts/JQuery/jquery-1.3.2.js" type="text/javascript"></script>
		<link href="../Styles/QUnit/qunit.css" type="text/css" rel="stylesheet" />
		<script src="../Scripts/QUnit/qunit.js" type="text/javascript"></script>
		<script src="../Scripts/MsAjax/MicrosoftAjax.debug.js" type="text/javascript"></script>
		<script src="../Scripts/MsAjax/MicrosoftAjaxTemplates.debug.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.js" type="text/javascript"></script>
		<script src="Common/exoweb.qunit.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.model.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.mapper.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.view.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.ui.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.mock.js" type="text/javascript"></script>
		<script src="../Scripts/mock-driver.js" type="text/javascript"></script>
		<script type="text/javascript">
			var ctx = ExoWeb.context({ model: { driver: { id: "1", from: "Driver", and: ["this.Owner.Location.Address.State", "this.Cars", "this.Dealer", "this.Dealer.AvailableCars"]} } });

			// reference the immediate parent dataview's data when that dataview is bound to a single object
			////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			setupTest("test1", { description: "Single hop with lone objects bound to parent dataview", expect: 2 }, function(result) {
				ok(result, "Result should be defined.");
				ok(result instanceof Dealer, "Result should be a Dealer");
			});
			
			// reference an ancestor dataview's data when that dataview is bound to a single object
			////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			setupTest("test2", { description: "Double hop with lone objects bound to parent dataview", expect: 2 }, function(result) {
				ok(result, "Result should be defined");
				ok(result instanceof Driver, "Result should be a Driver");
			});

			// reference the immediate parent dataview's data when the parent dataview is bound to a list (i.e.: list index)
			////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			setupTest("test3-0", { description: "Single hop with list of objects bound to parent dataview - 1", expect: 3 }, function(result) {
				ok(result, "Result should be defined");
				ok(result.meta.type == OwnerLocation.meta, "Result should be an OwnerLocation");
				equals(result.meta.id, 1, "Result's id should be 1");
			});
			setupTest("test3-1", { description: "Single hop with list of objects bound to parent dataview - 2", expect: 3 }, function(result) {
				ok(result, "Result2 should be defined");
				ok(result.meta.type == OwnerLocation.meta, "Result should be an OwnerLocation");
				equals(result.meta.id, 2, "Result's id should be 2");
			});

			timeoutTests(3000);
		</script>
	</head>
	<body xmlns:sys="javascript:Sys" xmlns:dataview="javascript:Sys.UI.DataView" sys:activate="*">
		
		<!-- QUnit Display -->
		<h1 id="qunit-header">Test Results:</h1>
		<h2 id="qunit-banner"></h2>
		<h2 id="qunit-userAgent"></h2>
		<ol id="qunit-tests"></ol>
		
		<div class="sys-template" sys:attach="dataview" dataview:data="{~ ctx.model.driver }">
			<h3>{ binding Name }</h3>
			<div class="sys-template" sys:attach="dataview" dataview:data="{~ Dealer }">
				<div>Dealer: <span>{{ Name }}</span></div>
				<br />
				
				Available Cars:
				<ul class="sys-template" sys:attach="dataview" dataview:data="{{ executeTest('test1', $parentContextData($element)).AvailableCars }}">
					<li>Car <span>{{ $dataItem.meta.id }}</span></li>
				</ul>
				
				Driver's Cars:
				<ul class="sys-template" sys:attach="dataview" dataview:data="{{ executeTest('test2', $parentContextData($element, $index, 2)).Cars }}">
					<li>Car <span>{{ $dataItem.meta.id }}</span></li>
				</ul>
				
			</div>
			
			Owner's Locations:
			<ul class="sys-template" sys:attach="dataview" dataview:data="{~ Owner.AvailableLocations }">
				<li>
					Available Location - 
					<span class="sys-template" sys:attach="dataview" dataview:data="{{ executeTest('test3-' + $index, $parentContextData($element, $index)).Address }}">
						{{ State.Name }}
					</span>
				</li>
			</ul>
		</div>
	</body>
</html><commit_msg>rename context variable, don't reference backing fields directly - either use binding or property getter<commit_after>﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>UI Helper Method Tests</title>
		<link href="../Common/styles.css" type="text/css" rel="stylesheet" />
		<script src="../Scripts/JQuery/jquery-1.3.2.js" type="text/javascript"></script>
		<link href="../Styles/QUnit/qunit.css" type="text/css" rel="stylesheet" />
		<script src="../Scripts/QUnit/qunit.js" type="text/javascript"></script>
		<script src="../Scripts/MsAjax/MicrosoftAjax.debug.js" type="text/javascript"></script>
		<script src="../Scripts/MsAjax/MicrosoftAjaxTemplates.debug.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.js" type="text/javascript"></script>
		<script src="Common/exoweb.qunit.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.model.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.mapper.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.view.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.ui.js" type="text/javascript"></script>
		<script src="../Scripts/ExoWeb/exoweb.mock.js" type="text/javascript"></script>
		<script src="../Scripts/mock-driver.js" type="text/javascript"></script>
		<script type="text/javascript">
			var context = ExoWeb.context({ model: { driver: { id: "1", from: "Driver", and: ["this.Owner.Location.Address.State", "this.Cars", "this.Dealer", "this.Dealer.AvailableCars"]} } });

			// reference the immediate parent dataview's data when that dataview is bound to a single object
			////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			setupTest("test1", { description: "Single hop with lone objects bound to parent dataview", expect: 2 }, function(result) {
				ok(result, "Result should be defined.");
				ok(result instanceof Dealer, "Result should be a Dealer");
			});
			
			// reference an ancestor dataview's data when that dataview is bound to a single object
			////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			setupTest("test2", { description: "Double hop with lone objects bound to parent dataview", expect: 2 }, function(result) {
				ok(result, "Result should be defined");
				ok(result instanceof Driver, "Result should be a Driver");
			});

			// reference the immediate parent dataview's data when the parent dataview is bound to a list (i.e.: list index)
			////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			setupTest("test3-0", { description: "Single hop with list of objects bound to parent dataview - 1", expect: 3 }, function(result) {
				ok(result, "Result should be defined");
				ok(result.meta.type == OwnerLocation.meta, "Result should be an OwnerLocation");
				equals(result.meta.id, 1, "Result's id should be 1");
			});
			setupTest("test3-1", { description: "Single hop with list of objects bound to parent dataview - 2", expect: 3 }, function(result) {
				ok(result, "Result2 should be defined");
				ok(result.meta.type == OwnerLocation.meta, "Result should be an OwnerLocation");
				equals(result.meta.id, 2, "Result's id should be 2");
			});

			timeoutTests(3000);
		</script>
	</head>
	<body xmlns:sys="javascript:Sys" xmlns:dataview="javascript:Sys.UI.DataView" sys:activate="*">
		
		<!-- QUnit Display -->
		<h1 id="qunit-header">Test Results:</h1>
		<h2 id="qunit-banner"></h2>
		<h2 id="qunit-userAgent"></h2>
		<ol id="qunit-tests"></ol>
		
		<div class="sys-template" sys:attach="dataview" dataview:data="{~ context.model.driver }">
			<h3>{binding Name}</h3>
			<div class="sys-template" sys:attach="dataview" dataview:data="{~ Dealer }">
				<div>Dealer: <span>{binding Name}</span></div>
				<br />
				
				Available Cars:
				<ul class="sys-template" sys:attach="dataview" dataview:data="{{ executeTest('test1', $parentContextData($element)).get_AvailableCars() }}">
					<li>Car <span>{{ $dataItem.meta.id }}</span></li>
				</ul>
				
				Driver's Cars:
				<ul class="sys-template" sys:attach="dataview" dataview:data="{{ executeTest('test2', $parentContextData($element, $index, 2)).get_Cars() }}">
					<li>Car <span>{{ $dataItem.meta.id }}</span></li>
				</ul>
				
			</div>
			
			Owner's Locations:
			<ul class="sys-template" sys:attach="dataview" dataview:data="{~ Owner.AvailableLocations }">
				<li>
					Available Location - 
					<span class="sys-template" sys:attach="dataview" dataview:data="{{ executeTest('test3-' + $index, $parentContextData($element, $index)).get_Address() }}">
						{binding State.Name}
					</span>
				</li>
			</ul>
		</div>
	</body>
</html>
{'fraction_non_alphanumeric': 0.24261581511037414, 'fraction_numerical': 0.00891284070888175, 'mean_word_length': 3.004149377593361, 'pattern_counts': {'":': 0, '<': 153, '<?xml version=': 0, '>': 153, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '2873059', 'n_tokens_mistral': 3382, 'n_tokens_neox': 2930, 'n_words': 682}