@quenty/instanceutils
Advanced tools
| { | ||
| "targets": { | ||
| "test": { | ||
| "universeId": 9716264427, | ||
| "placeId": 140543867367971, | ||
| "project": "test/default.project.json", | ||
| "scriptTemplate": "test/scripts/Server/ServerMain.server.lua" | ||
| } | ||
| } | ||
| } |
| { | ||
| "name": "InstanceUtilsTest", | ||
| "tree": { | ||
| "$className": "DataModel", | ||
| "ServerScriptService": { | ||
| "$properties": { | ||
| "LoadStringEnabled": true | ||
| }, | ||
| "instanceutils": { | ||
| "$path": ".." | ||
| }, | ||
| "Script": { | ||
| "$path": "scripts/Server" | ||
| } | ||
| } | ||
| } | ||
| } |
| --!nonstrict | ||
| --[[ | ||
| @class ServerMain | ||
| ]] | ||
| local ServerScriptService = game:GetService("ServerScriptService") | ||
| local root = ServerScriptService.instanceutils | ||
| local loader = root:FindFirstChild("LoaderUtils", true).Parent | ||
| local require = require(loader).bootstrapGame(root) | ||
| local NevermoreTestRunnerUtils = require("NevermoreTestRunnerUtils") | ||
| if NevermoreTestRunnerUtils.runTestsIfNeededAsync(root) then | ||
| return | ||
| end |
+31
-496
@@ -6,10 +6,12 @@ # Change Log | ||
| ## [13.29.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.29.1...@quenty/instanceutils@13.29.2) (2026-04-30) | ||
| # [13.30.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.29.2...@quenty/instanceutils@13.30.0) (2026-05-29) | ||
| **Note:** Version bump only for package @quenty/instanceutils | ||
| ### Bug Fixes | ||
| - Handle new animation constraints ([519e52a](https://github.com/Quenty/NevermoreEngine/commit/519e52a227fe241e30c9d92b6c9e6e92246552d3)) | ||
| ## [13.29.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.29.1...@quenty/instanceutils@13.29.2) (2026-04-30) | ||
| **Note:** Version bump only for package @quenty/instanceutils | ||
| ## [13.29.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.29.0...@quenty/instanceutils@13.29.1) (2026-04-29) | ||
@@ -19,6 +21,2 @@ | ||
| # [13.29.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.28.0...@quenty/instanceutils@13.29.0) (2026-04-23) | ||
@@ -28,6 +26,2 @@ | ||
| # [13.28.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.27.0...@quenty/instanceutils@13.28.0) (2026-04-14) | ||
@@ -37,39 +31,20 @@ | ||
| # [13.27.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.26.0...@quenty/instanceutils@13.27.0) (2026-02-20) | ||
| ### Features | ||
| * **cli:** add CI annotation support to game and plugin templates ([#666](https://github.com/Quenty/NevermoreEngine/issues/666)) ([098971b](https://github.com/Quenty/NevermoreEngine/commit/098971bb04dfe40be09f475330b69a48b38c54c5)) | ||
| - **cli:** add CI annotation support to game and plugin templates ([#666](https://github.com/Quenty/NevermoreEngine/issues/666)) ([098971b](https://github.com/Quenty/NevermoreEngine/commit/098971bb04dfe40be09f475330b69a48b38c54c5)) | ||
| # [13.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.25.0...@quenty/instanceutils@13.26.0) (2026-02-19) | ||
| ### Features | ||
| * **cli:** add aggregated batch test execution ([58f20e4](https://github.com/Quenty/NevermoreEngine/commit/58f20e437540c597ea445f47d47076c08ea9ca21)) | ||
| - **cli:** add aggregated batch test execution ([58f20e4](https://github.com/Quenty/NevermoreEngine/commit/58f20e437540c597ea445f47d47076c08ea9ca21)) | ||
| # [13.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.24.1...@quenty/instanceutils@13.25.0) (2026-02-17) | ||
| ### Features | ||
| * Add CI/CD batch unit testing ([016a366](https://github.com/Quenty/NevermoreEngine/commit/016a3663509c8fffa518b07cfc49ebecba2a1fa6)) | ||
| - Add CI/CD batch unit testing ([016a366](https://github.com/Quenty/NevermoreEngine/commit/016a3663509c8fffa518b07cfc49ebecba2a1fa6)) | ||
| ## [13.24.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.24.0...@quenty/instanceutils@13.24.1) (2026-01-21) | ||
@@ -79,17 +54,8 @@ | ||
| # [13.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.23.0...@quenty/instanceutils@13.24.0) (2026-01-18) | ||
| ### Features | ||
| * Add DynamicHide to the Hide package to allow for dynamically hiding content ([5c25a4c](https://github.com/Quenty/NevermoreEngine/commit/5c25a4ce76a35164de35cb3a1738e5fa5032336d)) | ||
| - Add DynamicHide to the Hide package to allow for dynamically hiding content ([5c25a4c](https://github.com/Quenty/NevermoreEngine/commit/5c25a4ce76a35164de35cb3a1738e5fa5032336d)) | ||
| # [13.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.22.2...@quenty/instanceutils@13.23.0) (2026-01-13) | ||
@@ -99,17 +65,8 @@ | ||
| ## [13.22.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.22.1...@quenty/instanceutils@13.22.2) (2026-01-12) | ||
| ### Bug Fixes | ||
| * Fix dependency installation process for pnpm ([9651b09](https://github.com/Quenty/NevermoreEngine/commit/9651b09af34f252ef3f9c7c539793cc878dd8cba)) | ||
| - Fix dependency installation process for pnpm ([9651b09](https://github.com/Quenty/NevermoreEngine/commit/9651b09af34f252ef3f9c7c539793cc878dd8cba)) | ||
| ## [13.22.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.22.0...@quenty/instanceutils@13.22.1) (2026-01-10) | ||
@@ -119,6 +76,2 @@ | ||
| # [13.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.21.0...@quenty/instanceutils@13.22.0) (2026-01-08) | ||
@@ -128,6 +81,2 @@ | ||
| # [13.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.20.6...@quenty/instanceutils@13.21.0) (2026-01-04) | ||
@@ -137,6 +86,2 @@ | ||
| ## [13.20.6](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.20.5...@quenty/instanceutils@13.20.6) (2026-01-03) | ||
@@ -146,6 +91,2 @@ | ||
| ## [13.20.5](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.20.4...@quenty/instanceutils@13.20.5) (2025-12-31) | ||
@@ -155,6 +96,2 @@ | ||
| ## [13.20.4](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.20.3...@quenty/instanceutils@13.20.4) (2025-12-29) | ||
@@ -164,6 +101,2 @@ | ||
| ## [13.20.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.20.2...@quenty/instanceutils@13.20.3) (2025-12-29) | ||
@@ -173,6 +106,2 @@ | ||
| ## [13.20.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.20.1...@quenty/instanceutils@13.20.2) (2025-11-22) | ||
@@ -182,6 +111,2 @@ | ||
| ## [13.20.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.20.0...@quenty/instanceutils@13.20.1) (2025-11-12) | ||
@@ -191,6 +116,2 @@ | ||
| # [13.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.19.0...@quenty/instanceutils@13.20.0) (2025-09-26) | ||
@@ -200,6 +121,2 @@ | ||
| # [13.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.18.1...@quenty/instanceutils@13.19.0) (2025-08-29) | ||
@@ -209,6 +126,2 @@ | ||
| ## [13.18.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.18.0...@quenty/instanceutils@13.18.1) (2025-08-12) | ||
@@ -218,6 +131,2 @@ | ||
| # [13.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.17.3...@quenty/instanceutils@13.18.0) (2025-05-10) | ||
@@ -227,6 +136,2 @@ | ||
| ## [13.17.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.17.2...@quenty/instanceutils@13.17.3) (2025-04-10) | ||
@@ -236,29 +141,15 @@ | ||
| ## [13.17.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.17.0...@quenty/instanceutils@13.17.2) (2025-04-07) | ||
| ### Bug Fixes | ||
| * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0)) | ||
| * Bump package versions for republishing ([ba47c62](https://github.com/Quenty/NevermoreEngine/commit/ba47c62e32170bf74377b0c658c60b84306dc294)) | ||
| - Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0)) | ||
| - Bump package versions for republishing ([ba47c62](https://github.com/Quenty/NevermoreEngine/commit/ba47c62e32170bf74377b0c658c60b84306dc294)) | ||
| ## [13.17.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.17.0...@quenty/instanceutils@13.17.1) (2025-04-07) | ||
| ### Bug Fixes | ||
| * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0)) | ||
| - Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0)) | ||
| # [13.17.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.16.2...@quenty/instanceutils@13.17.0) (2025-04-02) | ||
@@ -268,6 +159,2 @@ | ||
| ## [13.16.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.16.1...@quenty/instanceutils@13.16.2) (2025-03-31) | ||
@@ -277,6 +164,2 @@ | ||
| ## [13.16.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.16.0...@quenty/instanceutils@13.16.1) (2025-03-21) | ||
@@ -286,6 +169,2 @@ | ||
| # [13.16.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.15.0...@quenty/instanceutils@13.16.0) (2025-02-18) | ||
@@ -295,6 +174,2 @@ | ||
| # [13.15.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.14.0...@quenty/instanceutils@13.15.0) (2024-12-15) | ||
@@ -304,6 +179,2 @@ | ||
| # [13.14.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.13.0...@quenty/instanceutils@13.14.0) (2024-12-03) | ||
@@ -313,6 +184,2 @@ | ||
| # [13.13.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.12.0...@quenty/instanceutils@13.13.0) (2024-11-13) | ||
@@ -322,6 +189,2 @@ | ||
| # [13.12.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.11.1...@quenty/instanceutils@13.12.0) (2024-11-06) | ||
@@ -331,6 +194,2 @@ | ||
| ## [13.11.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.11.0...@quenty/instanceutils@13.11.1) (2024-11-04) | ||
@@ -340,6 +199,2 @@ | ||
| # [13.11.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.10.0...@quenty/instanceutils@13.11.0) (2024-11-03) | ||
@@ -349,6 +204,2 @@ | ||
| # [13.10.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.9.1...@quenty/instanceutils@13.10.0) (2024-10-23) | ||
@@ -358,6 +209,2 @@ | ||
| ## [13.9.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.9.0...@quenty/instanceutils@13.9.1) (2024-10-09) | ||
@@ -367,6 +214,2 @@ | ||
| # [13.9.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.8.1...@quenty/instanceutils@13.9.0) (2024-10-06) | ||
@@ -376,6 +219,2 @@ | ||
| ## [13.8.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.8.0...@quenty/instanceutils@13.8.1) (2024-10-04) | ||
@@ -385,6 +224,2 @@ | ||
| # [13.8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.7.0...@quenty/instanceutils@13.8.0) (2024-10-04) | ||
@@ -394,6 +229,2 @@ | ||
| # [13.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.6.0...@quenty/instanceutils@13.7.0) (2024-09-25) | ||
@@ -403,6 +234,2 @@ | ||
| # [13.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.5.0...@quenty/instanceutils@13.6.0) (2024-09-25) | ||
@@ -412,6 +239,2 @@ | ||
| # [13.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.4.0...@quenty/instanceutils@13.5.0) (2024-09-12) | ||
@@ -421,6 +244,2 @@ | ||
| # [13.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.3.0...@quenty/instanceutils@13.4.0) (2024-08-09) | ||
@@ -430,18 +249,9 @@ | ||
| # [13.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.2.0...@quenty/instanceutils@13.3.0) (2024-05-09) | ||
| ### Bug Fixes | ||
| * Bootstrap specifically to loader ([7f4d4f9](https://github.com/Quenty/NevermoreEngine/commit/7f4d4f9cd4a6602af8daaf04983bb349dafc7e95)) | ||
| * Fix .package-lock.json replicating in packages ([75d0efe](https://github.com/Quenty/NevermoreEngine/commit/75d0efeef239f221d93352af71a5b3e930ec23c5)) | ||
| - Bootstrap specifically to loader ([7f4d4f9](https://github.com/Quenty/NevermoreEngine/commit/7f4d4f9cd4a6602af8daaf04983bb349dafc7e95)) | ||
| - Fix .package-lock.json replicating in packages ([75d0efe](https://github.com/Quenty/NevermoreEngine/commit/75d0efeef239f221d93352af71a5b3e930ec23c5)) | ||
| # [13.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.1.0...@quenty/instanceutils@13.2.0) (2024-04-27) | ||
@@ -451,6 +261,2 @@ | ||
| # [13.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@13.0.0...@quenty/instanceutils@13.1.0) (2024-03-09) | ||
@@ -460,6 +266,2 @@ | ||
| # [13.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@12.0.0...@quenty/instanceutils@13.0.0) (2024-02-14) | ||
@@ -469,6 +271,2 @@ | ||
| # [12.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@11.0.0...@quenty/instanceutils@12.0.0) (2024-02-13) | ||
@@ -478,6 +276,2 @@ | ||
| # [11.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@10.0.0...@quenty/instanceutils@11.0.0) (2024-02-13) | ||
@@ -487,6 +281,2 @@ | ||
| # [10.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@9.0.0...@quenty/instanceutils@10.0.0) (2024-02-13) | ||
@@ -496,6 +286,2 @@ | ||
| # [9.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@8.4.0...@quenty/instanceutils@9.0.0) (2024-01-10) | ||
@@ -505,6 +291,2 @@ | ||
| # [8.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@8.3.0...@quenty/instanceutils@8.4.0) (2024-01-08) | ||
@@ -514,6 +296,2 @@ | ||
| # [8.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@8.2.0...@quenty/instanceutils@8.3.0) (2023-12-28) | ||
@@ -523,6 +301,2 @@ | ||
| # [8.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@8.1.1...@quenty/instanceutils@8.2.0) (2023-12-14) | ||
@@ -532,6 +306,2 @@ | ||
| ## [8.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@8.1.0...@quenty/instanceutils@8.1.1) (2023-10-28) | ||
@@ -541,6 +311,2 @@ | ||
| # [8.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@8.0.0...@quenty/instanceutils@8.1.0) (2023-10-18) | ||
@@ -550,6 +316,2 @@ | ||
| # [8.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.21.0...@quenty/instanceutils@8.0.0) (2023-10-11) | ||
@@ -559,6 +321,2 @@ | ||
| # [7.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.20.0...@quenty/instanceutils@7.21.0) (2023-09-21) | ||
@@ -568,6 +326,2 @@ | ||
| # [7.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.19.0...@quenty/instanceutils@7.20.0) (2023-09-04) | ||
@@ -577,6 +331,2 @@ | ||
| # [7.19.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.18.0...@quenty/instanceutils@7.19.0) (2023-08-23) | ||
@@ -586,6 +336,2 @@ | ||
| # [7.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.17.0...@quenty/instanceutils@7.18.0) (2023-07-28) | ||
@@ -595,6 +341,2 @@ | ||
| # [7.17.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.16.0...@quenty/instanceutils@7.17.0) (2023-07-15) | ||
@@ -604,17 +346,8 @@ | ||
| # [7.16.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.15.0...@quenty/instanceutils@7.16.0) (2023-07-10) | ||
| ### Features | ||
| * Add RxInstanceUtils.observeParentBrio(instance) ([d91395e](https://github.com/Quenty/NevermoreEngine/commit/d91395eed2cd77bd53b87db23a0692cac43843be)) | ||
| - Add RxInstanceUtils.observeParentBrio(instance) ([d91395e](https://github.com/Quenty/NevermoreEngine/commit/d91395eed2cd77bd53b87db23a0692cac43843be)) | ||
| # [7.15.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.14.0...@quenty/instanceutils@7.15.0) (2023-06-17) | ||
@@ -624,6 +357,2 @@ | ||
| # [7.14.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.13.0...@quenty/instanceutils@7.14.0) (2023-05-26) | ||
@@ -633,6 +362,2 @@ | ||
| # [7.13.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.12.0...@quenty/instanceutils@7.13.0) (2023-05-08) | ||
@@ -642,6 +367,2 @@ | ||
| # [7.12.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.11.1...@quenty/instanceutils@7.12.0) (2023-04-10) | ||
@@ -651,6 +372,2 @@ | ||
| ## [7.11.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.11.0...@quenty/instanceutils@7.11.1) (2023-04-07) | ||
@@ -660,17 +377,8 @@ | ||
| # [7.11.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.10.0...@quenty/instanceutils@7.11.0) (2023-04-06) | ||
| ### Bug Fixes | ||
| * Fix issue where we might potentially leak if we GC while the name change actually occurs ([4822fac](https://github.com/Quenty/NevermoreEngine/commit/4822facd757c77a2466d8ec619e8b3e9b9706446)) | ||
| - Fix issue where we might potentially leak if we GC while the name change actually occurs ([4822fac](https://github.com/Quenty/NevermoreEngine/commit/4822facd757c77a2466d8ec619e8b3e9b9706446)) | ||
| # [7.10.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.9.0...@quenty/instanceutils@7.10.0) (2023-04-03) | ||
@@ -680,6 +388,2 @@ | ||
| # [7.9.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.8.0...@quenty/instanceutils@7.9.0) (2023-03-31) | ||
@@ -689,6 +393,2 @@ | ||
| # [7.8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.7.0...@quenty/instanceutils@7.8.0) (2023-03-05) | ||
@@ -698,6 +398,2 @@ | ||
| # [7.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.6.0...@quenty/instanceutils@7.7.0) (2023-02-27) | ||
@@ -707,6 +403,2 @@ | ||
| # [7.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.5.0...@quenty/instanceutils@7.6.0) (2023-02-21) | ||
@@ -716,6 +408,2 @@ | ||
| # [7.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.4.0...@quenty/instanceutils@7.5.0) (2023-01-11) | ||
@@ -725,17 +413,8 @@ | ||
| # [7.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.3.1...@quenty/instanceutils@7.4.0) (2023-01-01) | ||
| ### Bug Fixes | ||
| * RxInstanceUtils.observeDescendantsOfClassBrio(parent, className) only observed children ([900bda0](https://github.com/Quenty/NevermoreEngine/commit/900bda08abfc1fe3f2aa85f545ab5ef9750df607)) | ||
| - RxInstanceUtils.observeDescendantsOfClassBrio(parent, className) only observed children ([900bda0](https://github.com/Quenty/NevermoreEngine/commit/900bda08abfc1fe3f2aa85f545ab5ef9750df607)) | ||
| ## [7.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.3.0...@quenty/instanceutils@7.3.1) (2022-12-27) | ||
@@ -745,6 +424,2 @@ | ||
| # [7.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.2.0...@quenty/instanceutils@7.3.0) (2022-12-05) | ||
@@ -754,6 +429,2 @@ | ||
| # [7.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.1.1...@quenty/instanceutils@7.2.0) (2022-11-19) | ||
@@ -763,6 +434,2 @@ | ||
| ## [7.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.1.0...@quenty/instanceutils@7.1.1) (2022-11-04) | ||
@@ -772,29 +439,15 @@ | ||
| # [7.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@7.0.0...@quenty/instanceutils@7.1.0) (2022-10-11) | ||
| ### Features | ||
| * Add RxInstanceUtils.observeDescendantsBrio(parent, predicate) ([6e34a60](https://github.com/Quenty/NevermoreEngine/commit/6e34a606a824a9255c60d1d83fd914b79ae0b31b)) | ||
| * Add RxInstanceUtils.observeDescendantsOfClassBrio() ([d0a2728](https://github.com/Quenty/NevermoreEngine/commit/d0a2728113387405ddd261a3930d562e2e2ad199)) | ||
| - Add RxInstanceUtils.observeDescendantsBrio(parent, predicate) ([6e34a60](https://github.com/Quenty/NevermoreEngine/commit/6e34a606a824a9255c60d1d83fd914b79ae0b31b)) | ||
| - Add RxInstanceUtils.observeDescendantsOfClassBrio() ([d0a2728](https://github.com/Quenty/NevermoreEngine/commit/d0a2728113387405ddd261a3930d562e2e2ad199)) | ||
| # [7.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@6.1.0...@quenty/instanceutils@7.0.0) (2022-09-27) | ||
| ### Features | ||
| * Add RxInstanceUtils.observeFirstAncestor ([8723b25](https://github.com/Quenty/NevermoreEngine/commit/8723b258c2590395f4d0eeb971a6a6c0e031a23a)) | ||
| - Add RxInstanceUtils.observeFirstAncestor ([8723b25](https://github.com/Quenty/NevermoreEngine/commit/8723b258c2590395f4d0eeb971a6a6c0e031a23a)) | ||
| # [6.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@6.0.1...@quenty/instanceutils@6.1.0) (2022-08-22) | ||
@@ -804,6 +457,2 @@ | ||
| ## [6.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@6.0.0...@quenty/instanceutils@6.0.1) (2022-08-16) | ||
@@ -813,6 +462,2 @@ | ||
| # [6.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@5.2.0...@quenty/instanceutils@6.0.0) (2022-08-14) | ||
@@ -822,6 +467,2 @@ | ||
| # [5.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@5.1.0...@quenty/instanceutils@5.2.0) (2022-07-31) | ||
@@ -831,28 +472,14 @@ | ||
| # [5.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@5.0.0...@quenty/instanceutils@5.1.0) (2022-06-21) | ||
| ### Features | ||
| * Add RxInstanceUtils.observeChildrenOfNameBrio ([5e5e9a5](https://github.com/Quenty/NevermoreEngine/commit/5e5e9a52bf6cd164bb59f9dc1fdba4470fa6e2dc)) | ||
| - Add RxInstanceUtils.observeChildrenOfNameBrio ([5e5e9a5](https://github.com/Quenty/NevermoreEngine/commit/5e5e9a52bf6cd164bb59f9dc1fdba4470fa6e2dc)) | ||
| # [5.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@4.2.0...@quenty/instanceutils@5.0.0) (2022-05-21) | ||
| ### Features | ||
| * Add RxInstanceUtils.observeFirstAncestorBrio(instance, className) ([c3ea0a7](https://github.com/Quenty/NevermoreEngine/commit/c3ea0a7c833eef97ab8ed86e8d3c7a35cbcd270b)) | ||
| - Add RxInstanceUtils.observeFirstAncestorBrio(instance, className) ([c3ea0a7](https://github.com/Quenty/NevermoreEngine/commit/c3ea0a7c833eef97ab8ed86e8d3c7a35cbcd270b)) | ||
| # [4.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@4.1.0...@quenty/instanceutils@4.2.0) (2022-03-27) | ||
@@ -862,6 +489,2 @@ | ||
| # [4.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@4.0.0...@quenty/instanceutils@4.1.0) (2022-03-10) | ||
@@ -871,6 +494,2 @@ | ||
| # [4.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.8.0...@quenty/instanceutils@4.0.0) (2022-03-06) | ||
@@ -880,6 +499,2 @@ | ||
| # [3.8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.7.1...@quenty/instanceutils@3.8.0) (2022-01-17) | ||
@@ -889,6 +504,2 @@ | ||
| ## [3.7.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.7.0...@quenty/instanceutils@3.7.1) (2022-01-16) | ||
@@ -898,6 +509,2 @@ | ||
| # [3.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.6.0...@quenty/instanceutils@3.7.0) (2022-01-07) | ||
@@ -907,17 +514,8 @@ | ||
| # [3.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.5.2...@quenty/instanceutils@3.6.0) (2022-01-03) | ||
| ### Bug Fixes | ||
| * Better error messages on RxInstanceUtils.observeProperty(instance, propertyName) ([4bc7824](https://github.com/Quenty/NevermoreEngine/commit/4bc782490f0dc420f64100d3d1bcc69ee4bc1a4d)) | ||
| - Better error messages on RxInstanceUtils.observeProperty(instance, propertyName) ([4bc7824](https://github.com/Quenty/NevermoreEngine/commit/4bc782490f0dc420f64100d3d1bcc69ee4bc1a4d)) | ||
| ## [3.5.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.5.1...@quenty/instanceutils@3.5.2) (2021-12-30) | ||
@@ -927,6 +525,2 @@ | ||
| ## [3.5.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.5.0...@quenty/instanceutils@3.5.1) (2021-12-30) | ||
@@ -936,6 +530,2 @@ | ||
| # [3.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.4.0...@quenty/instanceutils@3.5.0) (2021-12-18) | ||
@@ -945,6 +535,2 @@ | ||
| # [3.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.3.0...@quenty/instanceutils@3.4.0) (2021-12-14) | ||
@@ -954,28 +540,14 @@ | ||
| # [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.2.0...@quenty/instanceutils@3.3.0) (2021-11-20) | ||
| ### Bug Fixes | ||
| * Support MacOS syncing ([#225](https://github.com/Quenty/NevermoreEngine/issues/225)) ([03f9183](https://github.com/Quenty/NevermoreEngine/commit/03f918392c6a5bdd33f8a17c38de371d1e06c67a)) | ||
| - Support MacOS syncing ([#225](https://github.com/Quenty/NevermoreEngine/issues/225)) ([03f9183](https://github.com/Quenty/NevermoreEngine/commit/03f918392c6a5bdd33f8a17c38de371d1e06c67a)) | ||
| # [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.1.2...@quenty/instanceutils@3.2.0) (2021-10-30) | ||
| ### Features | ||
| * RxInstanceUtils.observeProperty also outputs the instance it observed the property on as the second argument ([1a556cd](https://github.com/Quenty/NevermoreEngine/commit/1a556cdd39463300f4f9a2090222aa084c9a497a)) | ||
| - RxInstanceUtils.observeProperty also outputs the instance it observed the property on as the second argument ([1a556cd](https://github.com/Quenty/NevermoreEngine/commit/1a556cdd39463300f4f9a2090222aa084c9a497a)) | ||
| ## [3.1.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.1.1...@quenty/instanceutils@3.1.2) (2021-10-30) | ||
@@ -985,6 +557,2 @@ | ||
| ## [3.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.1.0...@quenty/instanceutils@3.1.1) (2021-10-06) | ||
@@ -994,6 +562,2 @@ | ||
| # [3.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.0.1...@quenty/instanceutils@3.1.0) (2021-10-02) | ||
@@ -1003,17 +567,8 @@ | ||
| ## [3.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@3.0.0...@quenty/instanceutils@3.0.1) (2021-09-18) | ||
| ### Bug Fixes | ||
| * Fix undeclare package dependencies that prevented loading in certain situations ([a8be7e0](https://github.com/Quenty/NevermoreEngine/commit/a8be7e06a06506a71257862429934e2ed0f6f56b)) | ||
| - Fix undeclare package dependencies that prevented loading in certain situations ([a8be7e0](https://github.com/Quenty/NevermoreEngine/commit/a8be7e06a06506a71257862429934e2ed0f6f56b)) | ||
| # [3.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@2.1.0...@quenty/instanceutils@3.0.0) (2021-09-11) | ||
@@ -1023,6 +578,2 @@ | ||
| # [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@2.0.0...@quenty/instanceutils@2.1.0) (2021-09-05) | ||
@@ -1032,36 +583,20 @@ | ||
| # [2.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/instanceutils@1.2.0...@quenty/instanceutils@2.0.0) (2021-09-05) | ||
| ### Bug Fixes | ||
| * Remove peer dependencies. This is because lerna doesn't really support peer dependencies being linked and getting a new version on build, which is unfortunate. ([5f5aeee](https://github.com/Quenty/NevermoreEngine/commit/5f5aeeea8de9975435309e53679f0ef7064f9dd0)) | ||
| - Remove peer dependencies. This is because lerna doesn't really support peer dependencies being linked and getting a new version on build, which is unfortunate. ([5f5aeee](https://github.com/Quenty/NevermoreEngine/commit/5f5aeeea8de9975435309e53679f0ef7064f9dd0)) | ||
| # 1.2.0 (2021-07-31) | ||
| ### Bug Fixes | ||
| * Add CI and CD ([47513e9](https://github.com/Quenty/NevermoreEngine/commit/47513e9b568162707534af132396dd8756947dd3)) | ||
| * Adjust CI badge to show automatic build and release state ([5a55d3f](https://github.com/Quenty/NevermoreEngine/commit/5a55d3f19bf8d66a760d67da9b56ed47fab74656)) | ||
| * Fix selene linting ([45fc074](https://github.com/Quenty/NevermoreEngine/commit/45fc07489ee59127ac6582689f19a0e87c1e5b5a)) | ||
| - Add CI and CD ([47513e9](https://github.com/Quenty/NevermoreEngine/commit/47513e9b568162707534af132396dd8756947dd3)) | ||
| - Adjust CI badge to show automatic build and release state ([5a55d3f](https://github.com/Quenty/NevermoreEngine/commit/5a55d3f19bf8d66a760d67da9b56ed47fab74656)) | ||
| - Fix selene linting ([45fc074](https://github.com/Quenty/NevermoreEngine/commit/45fc07489ee59127ac6582689f19a0e87c1e5b5a)) | ||
| ## 1.0.2 (2021-07-25) | ||
| ## 1.0.1 (2021-07-25) | ||
| # 1.0.0 (2021-07-24) |
+3
-3
| { | ||
| "name": "@quenty/instanceutils", | ||
| "version": "13.29.2", | ||
| "version": "13.30.0", | ||
| "description": "Utility functions involving instances in Roblox", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@quenty/brio": "14.29.2", | ||
| "@quenty/brio": "14.30.0", | ||
| "@quenty/loader": "10.11.0", | ||
@@ -44,3 +44,3 @@ "@quenty/maid": "3.9.0", | ||
| }, | ||
| "gitHead": "7672b52f13af6a10df1b189d19d6e2404b5b3e55" | ||
| "gitHead": "f4a374a0a294ee8900aa5cb68ab138b0acf3e0ae" | ||
| } |
@@ -195,19 +195,26 @@ --!strict | ||
| function RxInstanceUtils._toPredicate(className: string | Rx.Predicate<Instance>): Rx.Predicate<Instance> | ||
| if type(className) == "string" then | ||
| return function(instance: Instance) | ||
| return instance:IsA(className) | ||
| end | ||
| else | ||
| return className | ||
| end | ||
| end | ||
| --[=[ | ||
| Observes the last child with a specific name. | ||
| @param parent Instance | ||
| @param className string | ||
| @param name string | ||
| @return Observable<Brio<Instance>> | ||
| ]=] | ||
| function RxInstanceUtils.observeLastNamedChildBrio( | ||
| parent: Instance, | ||
| className: string, | ||
| className: string | Rx.Predicate<Instance>, | ||
| name: string | ||
| ): Observable.Observable<Brio.Brio<Instance>> | ||
| assert(typeof(parent) == "Instance", "Bad parent") | ||
| assert(type(className) == "string", "Bad className") | ||
| assert(type(className) == "string" or type(className) == "function", "Bad className") | ||
| assert(type(name) == "string", "Bad name") | ||
| local predicate = RxInstanceUtils._toPredicate(className) | ||
| return Observable.new(function(sub) | ||
@@ -235,3 +242,3 @@ local topMaid = Maid.new() | ||
| local function handleChild(child: Instance) | ||
| if not child:IsA(className) then | ||
| if not predicate(child) then | ||
| return | ||
@@ -276,17 +283,14 @@ end | ||
| Observes the children with a specific name. | ||
| @param parent Instance | ||
| @param className string | ||
| @param name string | ||
| @return Observable<Brio<Instance>> | ||
| ]=] | ||
| function RxInstanceUtils.observeChildrenOfNameBrio( | ||
| parent: Instance, | ||
| className: string, | ||
| className: string | Rx.Predicate<Instance>, | ||
| name: string | ||
| ): Observable.Observable<Brio.Brio<Instance>> | ||
| assert(typeof(parent) == "Instance", "Bad parent") | ||
| assert(type(className) == "string", "Bad className") | ||
| assert(type(className) == "string" or type(className) == "function", "Bad className") | ||
| assert(type(name) == "string", "Bad name") | ||
| local predicate = RxInstanceUtils._toPredicate(className) | ||
| return Observable.new(function(sub) | ||
@@ -296,3 +300,3 @@ local topMaid = Maid.new() | ||
| local function handleChild(child: Instance) | ||
| if not child:IsA(className) then | ||
| if not predicate(child) then | ||
| return | ||
@@ -335,6 +339,2 @@ end | ||
| Observes all children of a specific class | ||
| @param parent Instance | ||
| @param className string | ||
| @return Observable<Brio<Instance>> | ||
| ]=] | ||
@@ -341,0 +341,0 @@ function RxInstanceUtils.observeChildrenOfClassBrio( |
@@ -10,2 +10,3 @@ --!nonstrict | ||
| local Brio = require("Brio") | ||
| local Jest = require("Jest") | ||
@@ -31,1 +32,341 @@ local RxInstanceUtils = require("RxInstanceUtils") | ||
| end) | ||
| describe("RxInstanceUtils.observeLastNamedChildBrio", function() | ||
| describe("with no children", function() | ||
| it("should not emit anything", function() | ||
| local parent = Instance.new("Folder") | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(0) | ||
| expect(lastBrio).toBeNil() | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("with a matching child already present", function() | ||
| it("should emit a brio with the child", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Part") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(1) | ||
| expect(lastBrio).never.toBeNil() | ||
| expect(Brio.isBrio(lastBrio)).toEqual(true) | ||
| expect(lastBrio:IsDead()).toEqual(false) | ||
| expect(lastBrio:GetValue()).toEqual(child) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("with wrong className", function() | ||
| it("should not emit for a child with the wrong class", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Folder") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function() | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(0) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("with wrong name", function() | ||
| it("should not emit for a child with the wrong name", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Part") | ||
| child.Name = "Wrong" | ||
| child.Parent = parent | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function() | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(0) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("when a child is added after subscription", function() | ||
| it("should emit when a matching child is added", function() | ||
| local parent = Instance.new("Folder") | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(0) | ||
| local child = Instance.new("Part") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| expect(fireCount).toEqual(1) | ||
| expect(lastBrio).never.toBeNil() | ||
| expect(Brio.isBrio(lastBrio)).toEqual(true) | ||
| expect(lastBrio:GetValue()).toEqual(child) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("when a matching child is removed", function() | ||
| it("should kill the previous brio", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Part") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(1) | ||
| local firstBrio = lastBrio | ||
| child.Parent = nil | ||
| expect(firstBrio:IsDead()).toEqual(true) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("when child name changes to match", function() | ||
| it("should emit when a child is renamed to the target name", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Part") | ||
| child.Name = "Wrong" | ||
| child.Parent = parent | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(0) | ||
| child.Name = "Target" | ||
| expect(fireCount).toEqual(1) | ||
| expect(lastBrio).never.toBeNil() | ||
| expect(lastBrio:GetValue()).toEqual(child) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("when child name changes away from match", function() | ||
| it("should kill the brio when a child is renamed away", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Part") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(1) | ||
| local firstBrio = lastBrio | ||
| child.Name = "NotTarget" | ||
| expect(firstBrio:IsDead()).toEqual(true) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("with multiple matching children", function() | ||
| it("should emit a brio with one of the children", function() | ||
| local parent = Instance.new("Folder") | ||
| local child1 = Instance.new("Part") | ||
| child1.Name = "Target" | ||
| child1.Parent = parent | ||
| local child2 = Instance.new("Part") | ||
| child2.Name = "Target" | ||
| child2.Parent = parent | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| -- Should have emitted (possibly more than once as children are iterated) | ||
| expect(lastBrio).never.toBeNil() | ||
| expect(Brio.isBrio(lastBrio)).toEqual(true) | ||
| expect(lastBrio:IsDead()).toEqual(false) | ||
| local value = lastBrio:GetValue() | ||
| -- The emitted child should be one of the two matching children | ||
| expect(value:IsA("Part")).toEqual(true) | ||
| expect(value.Name).toEqual("Target") | ||
| sub:Destroy() | ||
| end) | ||
| it("should switch to remaining child when the emitted one is removed", function() | ||
| local parent = Instance.new("Folder") | ||
| local child1 = Instance.new("Part") | ||
| child1.Name = "Target" | ||
| child1.Parent = parent | ||
| local child2 = Instance.new("Part") | ||
| child2.Name = "Target" | ||
| child2.Parent = parent | ||
| local lastBrio = nil | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| end) | ||
| local emittedChild = lastBrio:GetValue() | ||
| local otherChild = if emittedChild == child1 then child2 else child1 | ||
| -- Remove the currently emitted child | ||
| emittedChild.Parent = nil | ||
| -- Should now emit the other child | ||
| expect(lastBrio).never.toBeNil() | ||
| expect(lastBrio:IsDead()).toEqual(false) | ||
| expect(lastBrio:GetValue()).toEqual(otherChild) | ||
| sub:Destroy() | ||
| end) | ||
| it("should emit nothing when all matching children are removed", function() | ||
| local parent = Instance.new("Folder") | ||
| local child1 = Instance.new("Part") | ||
| child1.Name = "Target" | ||
| child1.Parent = parent | ||
| local child2 = Instance.new("Part") | ||
| child2.Name = "Target" | ||
| child2.Parent = parent | ||
| local lastBrio = nil | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| end) | ||
| expect(lastBrio).never.toBeNil() | ||
| child1.Parent = nil | ||
| child2.Parent = nil | ||
| -- The last brio should be dead since no matching children remain | ||
| expect(lastBrio:IsDead()).toEqual(true) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("subscription cleanup", function() | ||
| it("should kill the brio when subscription is destroyed", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Part") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| local lastBrio = nil | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| end) | ||
| expect(lastBrio).never.toBeNil() | ||
| expect(lastBrio:IsDead()).toEqual(false) | ||
| sub:Destroy() | ||
| expect(lastBrio:IsDead()).toEqual(true) | ||
| end) | ||
| end) | ||
| describe("className inheritance", function() | ||
| it("should match subclasses via IsA", function() | ||
| local parent = Instance.new("Folder") | ||
| local child = Instance.new("Part") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| local lastBrio = nil | ||
| local fireCount = 0 | ||
| -- Part IsA BasePart, so this should match | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "BasePart", "Target"):Subscribe(function(brio) | ||
| lastBrio = brio | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| expect(fireCount).toEqual(1) | ||
| expect(lastBrio:GetValue()).toEqual(child) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| describe("non-matching child added then removed", function() | ||
| it("should not emit for non-matching children", function() | ||
| local parent = Instance.new("Folder") | ||
| local fireCount = 0 | ||
| local sub = RxInstanceUtils.observeLastNamedChildBrio(parent, "Part", "Target"):Subscribe(function() | ||
| fireCount = fireCount + 1 | ||
| end) | ||
| local child = Instance.new("Folder") | ||
| child.Name = "Target" | ||
| child.Parent = parent | ||
| child.Parent = nil | ||
| expect(fireCount).toEqual(0) | ||
| sub:Destroy() | ||
| end) | ||
| end) | ||
| end) |
53431
22.88%12
33.33%47
135%+ Added
- Removed
Updated