From 642f0807bb2af9cb426e5c4f2ef1a61a39c46926 Mon Sep 17 00:00:00 2001 From: Fedor Zaytsev Date: Sat, 29 Feb 2020 03:23:41 -0800 Subject: [PATCH] Changeable icons for AppleScriptTouchBarItem & tests (#276) * Implemented changable icons for AppleScriptTouchBarItem AppleScriptTouchBarItem now allow to specify any number of icons which can be changed from the script. You cannot change icon from touch event. To change icon, you need to return array from your script with 2 values - title and icn name. More info in readme * Fixed tests Some tests started to fail after implementing alternativeIcons field for appleScriptBarItem --- MTMRTests/AppleScriptDefinitionTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MTMRTests/AppleScriptDefinitionTests.swift b/MTMRTests/AppleScriptDefinitionTests.swift index 98101b6..6e0d425 100644 --- a/MTMRTests/AppleScriptDefinitionTests.swift +++ b/MTMRTests/AppleScriptDefinitionTests.swift @@ -6,7 +6,7 @@ class AppleScriptDefinitionTests: XCTestCase { [ { "type": "appleScriptTitledButton", "source": { "inline": "tell everything fine" } } ] """.data(using: .utf8)! let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture) - guard case .appleScriptTitledButton(let source, _)? = result?.first?.type else { + guard case .appleScriptTitledButton(let source, _, _)? = result?.first?.type else { XCTFail() return } @@ -18,7 +18,7 @@ class AppleScriptDefinitionTests: XCTestCase { [ { "type": "appleScriptTitledButton", "source": { "filePath": "/ololo/pew" } } ] """.data(using: .utf8)! let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture) - guard case .appleScriptTitledButton(let source, _)? = result?.first?.type else { + guard case .appleScriptTitledButton(let source, _, _)? = result?.first?.type else { XCTFail() return } @@ -32,7 +32,7 @@ class AppleScriptDefinitionTests: XCTestCase { [ { "type": "appleScriptTitledButton", "source": { "filePath": "~/pew" } } ] """.data(using: .utf8)! let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture) - guard case .appleScriptTitledButton(let source, _)? = result?.first?.type else { + guard case .appleScriptTitledButton(let source, _, _)? = result?.first?.type else { XCTFail() return } @@ -58,7 +58,7 @@ class AppleScriptDefinitionTests: XCTestCase { [ { "type": "appleScriptTitledButton", "source": { "inline": "tell everything fine" }, "refreshInterval": 305} ] """.data(using: .utf8)! let result = try? JSONDecoder().decode([BarItemDefinition].self, from: buttonNoActionFixture) - guard case .appleScriptTitledButton(_, 305)? = result?.first?.type else { + guard case .appleScriptTitledButton(_, 305, _)? = result?.first?.type else { XCTFail() return }