From fe93f7ec66813dfde8fd5153846d326eafad7fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Kluczy=C5=84ski?= Date: Mon, 18 May 2015 20:37:52 +0200 Subject: [PATCH] Tests for deleting profile, and downgrading Intern to 2.2.2 --- Gruntfile.js | 4 ++-- package.json | 2 +- src/qunit-desktop-notifications.js | 3 +++ tests/functional/delete.js | 17 ++++++++++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4978bf9..bde52bc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,7 +13,7 @@ module.exports = function (grunt) { options: { runType: "client", config: "tests/intern", - reporters: [ "combined" ] + reporters: [ "Combined" ] } }, /** Local functional tests config. */ @@ -21,7 +21,7 @@ module.exports = function (grunt) { options: { runType: "runner", config: "tests/intern", - reporters: [ "combined" ] + reporters: [ "Combined" ] } }, /** CI unit tests config. */ diff --git a/package.json b/package.json index 7fb796c..fa540aa 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "test": "grunt test" }, "devDependencies": { - "intern": "theintern/intern#master", + "intern": "2.2.2", "grunt": "~0.4.5", "grunt-coveralls": "^1.0.0" } diff --git a/src/qunit-desktop-notifications.js b/src/qunit-desktop-notifications.js index bf85f11..2efb336 100644 --- a/src/qunit-desktop-notifications.js +++ b/src/qunit-desktop-notifications.js @@ -598,6 +598,9 @@ QUnitDesktopNotifications.profiles.new = function () { /** Deleting selected profile. */ QUnitDesktopNotifications.profiles.delete = function () { + var profileName = this.selectedProfileName(); + this.profile( profileName, null ); + this.refreshVisible(); }; /** In case QUnit was not found, generate error and don't initialize desktop notifications. */ diff --git a/tests/functional/delete.js b/tests/functional/delete.js index f9b01c5..2e85ff9 100644 --- a/tests/functional/delete.js +++ b/tests/functional/delete.js @@ -27,10 +27,21 @@ define([ .click() .end() .end() + /** Assert that the "silent" profile can be deleted, and delete it. */ .findByCssSelector( "button[action=\"delete\"]" ) - .isEnabled() - .then( function ( enabled ) { - assert.ok( enabled, "Delete button is enable when \"default\" profile is not selected." ); + .isEnabled() + .then( function ( enabled ) { + assert.ok( enabled, "Delete button is enable when \"default\" profile is not selected." ); + }) + .click() + .end() + /** Assert that the "silent" profile was deleted. */ + .waitForDeletedByCssSelector( "select option[name=\"silent\"]" ) + .execute( function () { + return QUnitDesktopNotifications.utils.localStorage( "silent" ); + }) + .then( function ( silent ) { + assert.equal( silent, null, "Item was deleted from local storage." ); }); },