<commit_before>describe("mousedown event", function () {

	$.fixture("plain");

	subject(function () {
		return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] });
	});

	beforeEach(function () {
		this.subject.input.focus();
		this.subject.open();
		$.type(this.subject.input, "ite");
		this.subject.next();
	});

	describe("with ul target", function () {
		it("does not select item", function () {
			spyOn(this.subject, "select");
			$.fire(this.subject.ul, "mousedown");

			expect(this.subject.select).not.toHaveBeenCalled();
		});
	});

	describe("with li target", function () {
		it("selects item", function () {
			var li = this.subject.ul.children[1];
			spyOn(this.subject, "select");
			$.fire(li, "mousedown");

			expect(this.subject.select).toHaveBeenCalledWith(li);
		});
	});

	describe("with child of li target", function () {
		it("selects item", function () {
			var li = this.subject.ul.children[1];
			spyOn(this.subject, "select");
			$.fire($("mark", li), "mousedown");

			expect(this.subject.select).toHaveBeenCalledWith(li);
		});
	});
});
<commit_msg>Tests for merged #16791 Don't select items on mouse right-click<commit_after>describe("mousedown event", function () {

	$.fixture("plain");

	subject(function () {
		return new Awesomplete("#plain", { list: ["item1", "item2", "item3"] });
	});

	beforeEach(function () {
		this.subject.input.focus();
		this.subject.open();
		$.type(this.subject.input, "ite");
		this.subject.next();

		spyOn(this.subject, "select");
	});

	def("li", function () { return this.subject.ul.children[1] });

	describe("with ul target", function () {
		def("target", function () { return this.subject.ul });

		it("does not select item", function () {
			$.fire(this.target, "mousedown", { button: 0 });
			expect(this.subject.select).not.toHaveBeenCalled();
		});
	});

	describe("with li target", function () {
		def("target", function () { return this.li });

		describe("on left click", function () {
			it("selects item", function () {
				$.fire(this.target, "mousedown", { button: 0 });
				expect(this.subject.select).toHaveBeenCalledWith(this.li);
			});
		});

		describe("on right click", function () {
			it("does not select item", function () {
				$.fire(this.target, "mousedown", { button: 2 });
				expect(this.subject.select).not.toHaveBeenCalled();
			});
		});
	});

	describe("with child of li target", function () {
		def("target", function () { return $("mark", this.li) });

		it("selects item", function () {
			$.fire(this.target, "mousedown", { button: 0 });
			expect(this.subject.select).toHaveBeenCalledWith(this.li);
		});
	});
});

{'fraction_non_alphanumeric': 0.21062618595825428, 'fraction_numerical': 0.00683111954459203, 'mean_word_length': 4.158512720156556, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6317509', 'n_tokens_mistral': 990, 'n_tokens_neox': 870, 'n_words': 169}