<commit_before>/*
 * Copyright (C) 2013 salesforce.com, inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
({

	testClickTriggerShow: {
		attributes : {"renderItem" : "triggers"},
		test: function(component) {
			var trigger = component.find('trigger1-trigger');
			var tt = component.find('trigger1');
			$A.test.clickOrTouch(trigger.getElement(), true, true);
			$A.test.addWaitFor(true, function(){
				return tt._tooltip.className.match(/visible/) ? true : false;
			}, function() {
				$A.test.assertTruthy(tt._tooltip.className.match(/visible/), 'The tooltip has the visible class');
			});
		}
	},

	testClickTriggerHide: {
		attributes : {"renderItem" : "triggers"},
		test: function(component) {
			var trigger = component.find('trigger1-trigger');
			var tt = component.find('trigger1');
			$A.test.clickOrTouch(trigger.getElement(), true, true);
			$A.test.addWaitFor(true, function(){
				return tt._tooltip.className.match(/visible/) ? true : false;
			}, function() {
				$A.test.clickOrTouch(trigger.getElement(), true, true);
				$A.test.addWaitFor(true, function(){
					return tt._tooltip.className.match(/visible/) ? false : true;
				}, function() {
					$A.test.assertFalsy(tt._tooltip.className.match(/visible/), 'The tooltip should not have the visible class');
				});
			});
		}
	},


	testAdvancedShow: {
		attributes : {"renderItem" : "advancedPositioning"},
		test: function(component) {
			var trigger = component.find('tooltip1-trigger').getElement();
			trigger.focus();
			var tt = component.find('tooltip1');
			console.log(tt._tooltip);
			$A.test.assertEquals('Hello world', $A.test.getText(tt._tooltip));
			$A.test.addWaitFor(true, function(){
				return tt._tooltip.className.match(/visible/) ? true : false;
			}, function() {
				$A.test.assertTruthy(tt._tooltip.className.match(/visible/), 'The tooltip has the visible class');
			});


		}
	},

	testAdvancedHide: {
		attributes : {"renderItem" : "advancedPositioning"},
		test: function(component) {
			var trigger = component.find('tooltip1-trigger').getElement();
			trigger.focus();
			
			var tt = component.find('tooltip1');
			$A.test.assertEquals('Hello world', $A.test.getText(tt._tooltip));
			setTimeout(function() {
				trigger.blur();
			}, 10);<commit_msg>Use Util function and addWaitForWithFailureMessage @bug W-2598206@ @rev ronak.shah@<commit_after>/*
 * Copyright (C) 2013 salesforce.com, inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
({

	testClickTriggerShow: {
		attributes : {"renderItem" : "triggers"},
		test: function(component) {
			var trigger = component.find('trigger1-trigger');
			var tt = component.find('trigger1');
			$A.test.clickOrTouch(trigger.getElement(), true, true);
			$A.test.addWaitFor(true, function(){
				return tt._tooltip.className.match(/visible/) ? true : false;
			}, function() {
				$A.test.assertTruthy(tt._tooltip.className.match(/visible/), 'The tooltip has the visible class');
			});
		}
	},

	testClickTriggerHide: {
		attributes : {"renderItem" : "triggers"},
		test: function(component) {
			var trigger = component.find('trigger1-trigger');
			var tt = component.find('trigger1');
			$A.test.clickOrTouch(trigger.getElement(), true, true);
			$A.test.addWaitFor(true, function(){
				return tt._tooltip.className.match(/visible/) ? true : false;
			}, function() {
				$A.test.clickOrTouch(trigger.getElement(), true, true);
				$A.test.addWaitFor(true, function(){
					return tt._tooltip.className.match(/visible/) ? false : true;
				}, function() {
					$A.test.assertFalsy(tt._tooltip.className.match(/visible/), 'The tooltip should not have the visible class');
				});
			});
		}
	},


	testAdvancedShow: {
		attributes : {"renderItem" : "advancedPositioning"},
		test: function(component) {
			var trigger = component.find('tooltip1-trigger').getElement();
			trigger.focus();
			var tt = component.find('tooltip1');
			$A.test.assertEquals('Hello world', $A.test.getText(tt._tooltip));
			$A.test.addWaitForWithFailureMessage(true, function(){return $A.util.hasClass(tt._tooltip,"visible");}, "The tooltip has the visible class");
		}
	},

	testAdvancedHide: {
		attributes : {"renderItem" : "advancedPositioning"},
		test: function(component) {
			var trigger = component.find('tooltip1-trigger').getElement();
			trigger.focus();
			
			var tt = component.find('tooltip1');
			$A.test.assertEquals('Hello world', $A.test.getText(tt._tooltip));
			setTimeout(function() {
				trigger.blur();
			}, 10);
{'fraction_non_alphanumeric': 0.151460185017232, 'fraction_numerical': 0.007799746054779612, 'mean_word_length': 4.031021897810219, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2655873', 'n_tokens_mistral': 1852, 'n_tokens_neox': 1616, 'n_words': 409}