Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/legacy/ui/public/fancy_forms/__tests__/nested_fancy_forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import ngMock from 'ng_mock';
import expect from '@kbn/expect';
import testSubjSelector from '@kbn/test-subj-selector';
import sinon from 'sinon';
import $ from 'jquery';

Expand Down Expand Up @@ -85,7 +86,7 @@ describe('fancy forms', function () {

expect($scope.person.errorCount()).to.be(1);
expect($scope.person.softErrorCount()).to.be(0);
$el.findTestSubject('submit').click();
$el.find(testSubjSelector('submit')).click();
expect($scope.person.errorCount()).to.be(1);
expect($scope.person.softErrorCount()).to.be(1);
});
Expand All @@ -96,7 +97,7 @@ describe('fancy forms', function () {

expect($scope.person.errorCount()).to.be(1);
sinon.assert.notCalled(onSubmit);
$el.findTestSubject('submit').click();
$el.find(testSubjSelector('submit')).click();
expect($scope.person.errorCount()).to.be(1);
sinon.assert.notCalled(onSubmit);

Expand All @@ -106,15 +107,15 @@ describe('fancy forms', function () {

expect($scope.person.errorCount()).to.be(0);
sinon.assert.notCalled(onSubmit);
$el.findTestSubject('submit').click();
$el.find(testSubjSelector('submit')).click();
expect($scope.person.errorCount()).to.be(0);
sinon.assert.calledOnce(onSubmit);
});

it('new fields are no longer soft after blur', function () {
const { $scope, $el } = setup({ name: '' });
expect($scope.person.softErrorCount()).to.be(0);
$el.findTestSubject('name').blur();
$el.find(testSubjSelector('name')).blur();
expect($scope.person.softErrorCount()).to.be(1);
});

Expand All @@ -139,7 +140,7 @@ describe('fancy forms', function () {
expect($scope.person.errorCount()).to.be(2);
expect($scope.person.softErrorCount()).to.be(0);

$el.findTestSubject('taskDesc').first().blur();
$el.find(testSubjSelector('taskDesc')).first().blur();

expect($scope.person.errorCount()).to.be(2);
expect($scope.person.softErrorCount()).to.be(1);
Expand Down Expand Up @@ -177,7 +178,7 @@ describe('fancy forms', function () {
expect(form.softErrorCount()).to.be(0);

// blurs only count locally
$task.findTestSubject('taskDesc').blur();
$task.find(testSubjSelector('taskDesc')).blur();
expect(form.softErrorCount()).to.be(1);

// but parent form see them
Expand Down
88 changes: 0 additions & 88 deletions src/legacy/ui/public/jquery/__tests__/find_test_subject.js

This file was deleted.

77 changes: 0 additions & 77 deletions src/legacy/ui/public/jquery/find_test_subject.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

import expect from '@kbn/expect';
import testSubjSelector from '@kbn/test-subj-selector';
import ngMock from 'ng_mock';
import sinon from 'sinon';
import $ from 'jquery';
Expand All @@ -43,7 +44,7 @@ describe('ui/modals/confirm_modal_promise', function () {

afterEach(function () {
$rootScope.$digest();
$.findTestSubject('confirmModalConfirmButton').click();
$(testSubjSelector('confirmModalConfirmButton')).click();
});

describe('before timeout completes', function () {
Expand All @@ -58,7 +59,7 @@ describe('ui/modals/confirm_modal_promise', function () {
describe('after timeout completes', function () {
it('confirmation dialogue is loaded to dom with message', function () {
$rootScope.$digest();
const confirmModalElement = $.findTestSubject('confirmModal');
const confirmModalElement = $(testSubjSelector('confirmModal'));
expect(confirmModalElement).to.not.be(undefined);

const htmlString = confirmModalElement[0].innerHTML;
Expand All @@ -73,7 +74,7 @@ describe('ui/modals/confirm_modal_promise', function () {

promise.then(confirmCallback, cancelCallback);
$rootScope.$digest();
const confirmButton = $.findTestSubject('confirmModalConfirmButton');
const confirmButton = $(testSubjSelector('confirmModalConfirmButton'));

confirmButton.click();
expect(confirmCallback.called).to.be(true);
Expand All @@ -88,7 +89,7 @@ describe('ui/modals/confirm_modal_promise', function () {
promise.then(confirmCallback, cancelCallback);

$rootScope.$digest();
const noButton = $.findTestSubject('confirmModalCancelButton');
const noButton = $(testSubjSelector('confirmModalCancelButton'));
noButton.click();

expect(cancelCallback.called).to.be(true);
Expand Down
4 changes: 0 additions & 4 deletions src/legacy/ui/public/test_harness/test_harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/

// chrome expects to be loaded first, let it get its way
import $ from 'jquery';
import bindJqueryToFindTestSubject from 'ui/jquery/find_test_subject';
import chrome from '../chrome';

import { parse as parseUrl } from 'url';
Expand All @@ -32,8 +30,6 @@ import './test_harness.css';
import 'ng_mock';
import { setupTestSharding } from './test_sharding';

bindJqueryToFindTestSubject($);

const { query } = parseUrl(window.location.href, true);
if (query && query.mocha) {
try {
Expand Down