<commit_before>/*global QUnit*/

sap.ui.define([
	"sap/ui/dt/Overlay",
	"sap/ui/dt/ElementOverlay",
	"sap/ui/dt/AggregationOverlay",
	"sap/ui/dt/AggregationDesignTimeMetadata",
	"sap/ui/dt/DOMUtil",
	"sap/m/Page",
	"sap/m/Button",
	"sap/m/Panel",
	"sap/ui/thirdparty/jquery",
	"sap/ui/thirdparty/sinon-4"
],
function(
	Overlay,
	ElementOverlay,
	AggregationOverlay,
	AggregationDesignTimeMetadata,
	DOMUtil,
	Page,
	Button,
	Panel,
	jQuery,
	sinon
) {
	"use strict";
	var sandbox = sinon.sandbox.create();
	QUnit.module("Given that an AggregationOverlay is created for an aggregation without domRef DT metadata and without children", {
		beforeEach: function() {
			this.oPage = new Page();
			this.oPage.placeAt("qunit-fixture");
			sap.ui.getCore().applyChanges();

			this.oAggregationOverlay = new AggregationOverlay({
				element: this.oPage,
				designTimeMetadata: new AggregationDesignTimeMetadata()
			});
			Overlay.getOverlayContainer().append(this.oAggregationOverlay.render());
		},
		afterEach: function() {
			this.oPage.destroy();
			this.oAggregationOverlay.destroy();
			Overlay.removeOverlayContainer();
		}
	}, function () {
		QUnit.test("when AggregationOverlay is initialized", function(assert) {
			assert.strictEqual(this.oAggregationOverlay.getGeometry(), undefined, "geometry for the overlay is undefined when no children are given");
			assert.strictEqual(DOMUtil.isVisible(this.oAggregationOverlay.getDomRef()), false, "aggregation is hidden because no children are given");
		});
	});

	QUnit.module("Given that an AggregationOverlay is created for an aggregation with domRef DT metadata", {
		beforeEach: function(assert) {
			var fnDone = assert.async();
			this.oPage = new Page();
			this.oPage.placeAt("qunit-fixture");
			sap.ui.getCore().applyChanges();

			this.oAggregationOverlay = new AggregationOverlay({
				isRoot: true,
				element: this.oPage,
				designTimeMetadata: new AggregationDesignTimeMetadata({
					data : {
						domRef : ":sap-domref > section"
					}
				})
			});
			Overlay.getOverlayContainer().append(this.oAggregationOverlay.render());
			this.oAggregationOverlay.attachEventOnce("geometryChanged", function() {
				fnDone();
			});
			this.oAggregationOverlay.applyStyles();
		},
		afterEach: function() {<commit_msg>[INTERNAL] sap.ui.dt: added debounce to AggregationOverlay test<commit_after>/*global QUnit*/

sap.ui.define([
	"sap/ui/dt/Overlay",
	"sap/ui/dt/ElementOverlay",
	"sap/ui/dt/AggregationOverlay",
	"sap/ui/dt/AggregationDesignTimeMetadata",
	"sap/ui/dt/DOMUtil",
	"sap/ui/dt/Util",
	"sap/m/Page",
	"sap/m/Button",
	"sap/m/Panel",
	"sap/ui/thirdparty/jquery",
	"sap/ui/thirdparty/sinon-4"
],
function(
	Overlay,
	ElementOverlay,
	AggregationOverlay,
	AggregationDesignTimeMetadata,
	DOMUtil,
	DtUtil,
	Page,
	Button,
	Panel,
	jQuery,
	sinon
) {
	"use strict";
	var sandbox = sinon.sandbox.create();
	QUnit.module("Given that an AggregationOverlay is created for an aggregation without domRef DT metadata and without children", {
		beforeEach: function() {
			this.oPage = new Page();
			this.oPage.placeAt("qunit-fixture");
			sap.ui.getCore().applyChanges();

			this.oAggregationOverlay = new AggregationOverlay({
				element: this.oPage,
				designTimeMetadata: new AggregationDesignTimeMetadata()
			});
			Overlay.getOverlayContainer().append(this.oAggregationOverlay.render());
		},
		afterEach: function() {
			this.oPage.destroy();
			this.oAggregationOverlay.destroy();
			Overlay.removeOverlayContainer();
		}
	}, function () {
		QUnit.test("when AggregationOverlay is initialized", function(assert) {
			assert.strictEqual(this.oAggregationOverlay.getGeometry(), undefined, "geometry for the overlay is undefined when no children are given");
			assert.strictEqual(DOMUtil.isVisible(this.oAggregationOverlay.getDomRef()), false, "aggregation is hidden because no children are given");
		});
	});

	QUnit.module("Given that an AggregationOverlay is created for an aggregation with domRef DT metadata", {
		beforeEach: function(assert) {
			var done = assert.async();
			this.oPage = new Page();
			this.oPage.placeAt("qunit-fixture");
			sap.ui.getCore().applyChanges();

			this.oAggregationOverlay = new AggregationOverlay({
				isRoot: true,
				element: this.oPage,
				designTimeMetadata: new AggregationDesignTimeMetadata({
					data : {
						domRef : ":sap-domref > section"
					}
				})
			});
			Overlay.getOverlayContainer().append(this.oAggregationOverlay.render());

			var fnDebounced = DtUtil.debounce(function() {
				this.oAggregationOverlay.detachEvent("geometryChanged", fnDebounced);
				done();
			}.bind(this));
			this.oAggregationOverlay.attachEvent("geometryChanged", fnDebounced);

			this.oAggregationOverlay.applyStyles();
		},
		afterEach: function() {
{'fraction_non_alphanumeric': 0.13668763102725368, 'fraction_numerical': 0.0004192872117400419, 'mean_word_length': 4.606345475910693, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, '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': '3833885', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1577, 'n_words': 292}