<commit_before><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

	<title>_WidgetBase lifecycle unit test</title>

	<script type="text/javascript" src="../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
	<script type="text/javascript">
		require([
			"doh/runner",
			"dojo/_base/declare", "dojo/dom",
			"dijit/registry", "dijit/_WidgetBase",
			"dojo/domReady!"
		], function(doh, declare, dom, registry, _WidgetBase){

			var obj = {
				foo: function(){
					// summary: empty function that we connect to
				}
			};

			// Number of times foo was called while TestWidget existed
			var calls = 0;

			declare("TestWidget", _WidgetBase, {
				postMixInProperties: function(){
					// make sure we can call set for parameters that don't touch the DOM
					this.set("foo", "bar");
				},
				postCreate: function(){
					// Rather odd call to this.connect() For testing the connections are dropped on destroy()
					this.connect(obj, "foo", function(){
						calls++;
					});
				}
			});

			var w;

			doh.register("create and destroy", [
				{
					name: "create",
					runTest: function(t){
						w = new TestWidget({id: "w1"}, "w1");

						doh.t(registry.byId("w1"), "widget in registry");

						// since there's no template, the widget just points to the srcNodeRef
						doh.is(w.domNode, dom.byId("w1"), "srcNodeRef read in");

						// test the connection
						doh.is(0, calls, "foo() not called yet");
						obj.foo();
						doh.is(1, calls, "foo() called");
					}
				},
				{
					name: "destroy",
					runTest: function(t){
						w.destroy();

						doh.f(registry.byId("w1"), "widget no longer in registry");

						// test the connection was destroyed
						calls = 0;
						obj.foo();
						doh.is(0, calls, "connection was deleted");

						// test the DOM node was removed
						doh.f(dom.byId("w1"), "DOM Node removed");
					}
				},
				{
					name: "destroy(true)  (preserving DOM node)",
					runTest: function(t){
						w = new TestWidget({id: "w2"}, "w2");

						doh.t(registry.byId("w2"), "widget in registry");
						w.destroy(true);

						doh.f(registry.byId("w2"), "widget no longer in registry");

						// test the DOM node *wasn't* removed
						doh.t(dom.byId("w2"), "DOM Node left");
					}
				},
				{
					name: "create with undefined id",
					runTest: function(t){
						// If id is "specified" as undefined, generate a new one
						w = new TestWidget({id: undefined});

						doh.isNot(undefined, w.id)
					}
				}
			]);

			doh.register("setter calls on creation", function(){
				// Make sure setters are called even for anonymous classes (#12122),
				// and even when there's no value explicitly specified in the parameters
				var fooSetterCalled,
					MyWidget = declare(_WidgetBase, {
						foo: 345,
						_setFooAttr: function(val){
							fooSetterCalled = val;
							this.foo = val;
						}
					});<commit_msg>use this._set() to save value in custom setter, refs #11251<commit_after><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

	<title>_WidgetBase lifecycle unit test</title>

	<script type="text/javascript" src="../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
	<script type="text/javascript">
		require([
			"doh/runner",
			"dojo/_base/declare", "dojo/dom",
			"dijit/registry", "dijit/_WidgetBase",
			"dojo/domReady!"
		], function(doh, declare, dom, registry, _WidgetBase){

			var obj = {
				foo: function(){
					// summary: empty function that we connect to
				}
			};

			// Number of times foo was called while TestWidget existed
			var calls = 0;

			declare("TestWidget", _WidgetBase, {
				postMixInProperties: function(){
					// make sure we can call set for parameters that don't touch the DOM
					this.set("foo", "bar");
				},
				postCreate: function(){
					// Rather odd call to this.connect() For testing the connections are dropped on destroy()
					this.connect(obj, "foo", function(){
						calls++;
					});
				}
			});

			var w;

			doh.register("create and destroy", [
				{
					name: "create",
					runTest: function(t){
						w = new TestWidget({id: "w1"}, "w1");

						doh.t(registry.byId("w1"), "widget in registry");

						// since there's no template, the widget just points to the srcNodeRef
						doh.is(w.domNode, dom.byId("w1"), "srcNodeRef read in");

						// test the connection
						doh.is(0, calls, "foo() not called yet");
						obj.foo();
						doh.is(1, calls, "foo() called");
					}
				},
				{
					name: "destroy",
					runTest: function(t){
						w.destroy();

						doh.f(registry.byId("w1"), "widget no longer in registry");

						// test the connection was destroyed
						calls = 0;
						obj.foo();
						doh.is(0, calls, "connection was deleted");

						// test the DOM node was removed
						doh.f(dom.byId("w1"), "DOM Node removed");
					}
				},
				{
					name: "destroy(true)  (preserving DOM node)",
					runTest: function(t){
						w = new TestWidget({id: "w2"}, "w2");

						doh.t(registry.byId("w2"), "widget in registry");
						w.destroy(true);

						doh.f(registry.byId("w2"), "widget no longer in registry");

						// test the DOM node *wasn't* removed
						doh.t(dom.byId("w2"), "DOM Node left");
					}
				},
				{
					name: "create with undefined id",
					runTest: function(t){
						// If id is "specified" as undefined, generate a new one
						w = new TestWidget({id: undefined});

						doh.isNot(undefined, w.id)
					}
				}
			]);

			doh.register("setter calls on creation", function(){
				// Make sure setters are called even for anonymous classes (#12122),
				// and even when there's no value explicitly specified in the parameters
				var fooSetterCalled,
					MyWidget = declare(_WidgetBase, {
						foo: 345,
						_setFooAttr: function(val){
							fooSetterCalled = val;
							this._set("foo", val);
						}
					});
{'fraction_non_alphanumeric': 0.15637098131627672, 'fraction_numerical': 0.010940919037199124, 'mean_word_length': 2.5495818399044206, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4712226', 'n_tokens_mistral': 2635, 'n_tokens_neox': 1929, 'n_words': 547}