From 464dcb107b4e3cfc549cf757aeeacaaa08c05d4b Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 12 Apr 2023 17:10:05 -0400 Subject: [PATCH] Delete detectedItemType if it matches items (#23) --- testTranslators/translatorTester.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/testTranslators/translatorTester.js b/testTranslators/translatorTester.js index 5be6417..64bdaa9 100644 --- a/testTranslators/translatorTester.js +++ b/testTranslators/translatorTester.js @@ -741,13 +741,18 @@ Zotero_TranslatorTester.prototype._createTest = function(translate, detectResult var items = translate.newItems; } - testReadyCallback(this, - { - type: this.type, - url: translate.document.location.href, - detectedItemType: detectResult, - items: items, - }); + let testObject = { + type: this.type, + url: translate.document.location.href, + detectedItemType: detectResult, + items, + }; + // Delete detectedItemType if it matches items + if (items === 'multiple' && detectResult === 'multiple' + || items.length == 1 && detectResult === items[0].itemType) { + delete testObject.detectedItemType; + } + testReadyCallback(this, testObject); };