diff --git a/tests/javascript/joomla-field-send-test-mail/fixtures/fixture.html b/tests/javascript/joomla-field-send-test-mail/fixtures/fixture.html deleted file mode 100644 index 387e1d0220159..0000000000000 --- a/tests/javascript/joomla-field-send-test-mail/fixtures/fixture.html +++ /dev/null @@ -1,19 +0,0 @@ -
- - - - - - - - - - - - - - diff --git a/tests/javascript/joomla-field-send-test-mail/spec-setup.js b/tests/javascript/joomla-field-send-test-mail/spec-setup.js deleted file mode 100644 index 46270d3eabe92..0000000000000 --- a/tests/javascript/joomla-field-send-test-mail/spec-setup.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @package Joomla.Tests - * @subpackage JavaScript Tests - * - * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - * - * @since 3.6.3 - * @version 1.0.0 - */ - -define(['jquery', 'text!testsRoot/joomla-field-send-test-mail/fixtures/fixture.html', 'media/system/webcomponents/js/joomla-field-send-test-mail', 'libs/core'], ($, fixture) => { - $('body').append(fixture); - - mailResponses = { - success: { - status: 200, - statusText: 'HTTP/1.1 200 OK', - responseText: '{"messages": {"message": "text"}}' - }, - successInvalid: { - status: 200, - statusText: 'HTTP/1.1 200 OK', - responseText: '{"messages": "text"}' - }, - fail: { - status: 404, - statusText: 'HTTP/1.1 404 Not Found', - responseText: 'Error' - } - }; - - email_data = { - smtpauth : ['smtpauth'], - smtpuser : ['smtpuser'], - smtppass : ['smtppass'], - smtphost : ['smtphost'], - smtpsecure: ['smtpsecure'], - smtpport : ['smtpport'], - mailfrom : ['mailfrom'], - fromname : ['fromname'], - mailer : ['mailer'], - mailonline: ['mailonline'] - }; - - document.getElementById('sendtestmail').click(); -}); diff --git a/tests/javascript/joomla-field-send-test-mail/spec.js b/tests/javascript/joomla-field-send-test-mail/spec.js deleted file mode 100644 index 2410f2b895d96..0000000000000 --- a/tests/javascript/joomla-field-send-test-mail/spec.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @package Joomla.Tests - * @subpackage JavaScript Tests - * - * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt - * - * @since 3.6.3 - * @version 1.0.0 - */ - -define(['jquery', 'testsRoot/joomla-field-send-test-mail/spec-setup', 'jasmineJquery'], ($) => { - describe('Sendtestmail', () => { - beforeAll(() => { - jasmine.Ajax.install(); - - renderFn = Joomla.renderMessages; - removeFn = Joomla.removeMessages; - ajxerrFn = Joomla.ajaxErrorsMessages; - scrollFn = window.scrollTo; - - Joomla.renderMessages = jasmine.createSpy('renderMessages'); - Joomla.removeMessages = jasmine.createSpy('removeMessages'); - Joomla.ajaxErrorsMessages = jasmine.createSpy('ajaxErrorsMessages'); - window.scrollTo = jasmine.createSpy('scrollTo'); - - $('#sendtestmail').click(); - }); - - afterAll(() => { - jasmine.Ajax.uninstall(); - - Joomla.renderMessages = renderFn; - Joomla.removeMessages = removeFn; - Joomla.ajaxErrorsMessages = ajxerrFn; - window.scrollTo = scrollFn; - }); - - it('Should call removeMessages()', () => { - expect(Joomla.removeMessages).toHaveBeenCalled(); - }); - - describe("on success with typeof response.messages !== 'object'", () => { - beforeAll(() => { - request = jasmine.Ajax.requests.mostRecent(); - request.respondWith(mailResponses.successInvalid); - }); - - it("should call Joomla.renderMessages({})", () => { - expect(Joomla.renderMessages).not.toHaveBeenCalledWith({}); - }); - }); - - describe("on success with typeof response.messages == 'object' && response.messages !== null", function() { - beforeAll(() => { - $('#sendtestmail').click(); - - request = jasmine.Ajax.requests.mostRecent(); - request.respondWith(mailResponses.success); - }); - - it("should make an AJAX request of type POST", () => { - expect(request.method).toBe('POST'); - }); - - // @TODO re add should set data to the request test - - it("should set url value to 'uri'", () => { - expect(request.url).toBe('uri'); - }); - - it("should call Joomla.renderMessages({'message': 'text'})", () => { - expect(Joomla.renderMessages).toHaveBeenCalledWith({"message": "text"}); - }); - }); - - describe("on failure", () => { - beforeAll(() => { - $('#sendtestmail').click(); - - request = jasmine.Ajax.requests.mostRecent(); - request.respondWith(mailResponses.fail); - }); - - // @TODO re add should call Joomla.ajaxErrorsMessages(jqXHR, 'error', 'HTTP/1.1 404 Not Found') test - - it("should call Joomla.renderMessages(undefined)", () => { - expect(Joomla.renderMessages).toHaveBeenCalledWith(undefined); - }); - }); - }); -});