<commit_before>describe('mobie.components.action-sheet', function () {
	var $rootScope, $animate, $mbActionSheet, $timeout;

	beforeEach(module('ngAnimateMock'));
	beforeEach(module('mobie'));
	beforeEach(inject(function (_$rootScope_, _$animate_, _$mbActionSheet_, _$timeout_) {
		$rootScope = _$rootScope_;
		$animate = _$animate_;
		$timeout = _$timeout_;
		$mbActionSheet = _$mbActionSheet_;
	}));

	describe('$actionSheet', function () {
		it('should show an action sheet', function () {
			$mbActionSheet.show({
				buttons: [{
					text: 'Button 1'
				}]
			});

			assert.ok(angular.element(document.querySelector('.action-sheet-wrapper')).hasClass('mb-visible'));
			assert.equal('Button 1', document.querySelector('.action-sheet-wrapper .button').textContent);
		});

		it('should support several shows', function () {
			for(var i=0; i<10; i++) {
				$mbActionSheet.show({
					buttons: [{
						text: 'Button ' + i
					}]
				});
				assert.equal('Button ' + i, document.querySelector('.action-sheet-wrapper .button').textContent);
			}
		});

		it('should return a promise which will be resolved when the user closes the component', function () {
			var finished = false;
			$mbActionSheet.show({
				buttons: [{
					text: 'Btn 1'
				}]
			}).then(function () {
				finished = true;
			});
			$animate.triggerCallbacks()
			$timeout.flush()

			assert.equal(false, finished);

			$mbActionSheet.hide();			
			$animate.triggerCallbacks()
			$timeout.flush();

			assert.ok(finished);
		});
	});
});<commit_msg>chore($mbActionSheet): better tests, checking if the returned promise of `$mbActionSheet#hide` and `$mbActionSheet#show` method works properly<commit_after>describe('mobie.components.action-sheet', function () {
	var $rootScope, $animate, $mbActionSheet, $timeout;

	beforeEach(module('ngAnimateMock'));
	beforeEach(module('mobie'));
	beforeEach(inject(function (_$rootScope_, _$animate_, _$mbActionSheet_, _$timeout_) {
		$rootScope = _$rootScope_;
		$animate = _$animate_;
		$timeout = _$timeout_;
		$mbActionSheet = _$mbActionSheet_;
	}));

	describe('$actionSheet', function () {
		it('should show an action sheet', function () {
			$mbActionSheet.show({
				buttons: [{
					text: 'Button 1'
				}]
			});

			assert.ok(angular.element(document.querySelector('.action-sheet-wrapper')).hasClass('mb-visible'));
			assert.equal('Button 1', document.querySelector('.action-sheet-wrapper .button').textContent);
		});

		it('should support several shows', function () {
			for(var i=0; i<10; i++) {
				$mbActionSheet.show({
					buttons: [{
						text: 'Button ' + i
					}]
				});
				assert.equal('Button ' + i, document.querySelector('.action-sheet-wrapper .button').textContent);
			}
		});

		it('should return a promise which will be resolved when the user closes the component', function () {
			var finished = false;
			$mbActionSheet.show({
				buttons: [{
					text: 'Btn 1'
				}]
			}).then(function () {
				finished = true;
			});

			$animate.triggerCallbacks()
			$timeout.flush();

			assert.equal(false, finished);

			$mbActionSheet.hide();
			$animate.triggerCallbacks();

			assert.ok(finished);

			var hasShowed = false;
			$mbActionSheet.show({
				buttons: [{
					text: 'Btn 2'
				}]
			});

			$animate.triggerCallbacks();

			$mbActionSheet.hide().then(function () {
				hasShowed = true;
			});

			$animate.triggerCallbacks();
			$timeout.flush();

			assert.equal(false, hasShowed);

			$mbActionSheet.show({
				buttons: [{
					text: 'Btn 2'
				}]
			});
			
			assert.equal(false, hasShowed);

			$animate.triggerCallbacks();
			$timeout.flush();

			assert.ok(hasShowed);
		});
	});
});
{'fraction_non_alphanumeric': 0.17113910186199344, 'fraction_numerical': 0.0038335158817086527, 'mean_word_length': 3.731865284974093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1071848', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1141, 'n_words': 223}