Skip to content

Commit b84c348

Browse files
committed
Minor: Update Tabs.Status to TabStatus enum type
1 parent 9ea3f0e commit b84c348

5 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/WebExtensions.Net.Generator/appsettings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@
163163
"ReplacePropertyTypes": {
164164
"InjectionTarget.frameIds": { "Type": "Array", "ArrayItems": { "Type": "Integer" } },
165165
"InjectionTarget.tabId": { "Type": "Integer" },
166+
"ChangeInfo.status": { "Ref": "Tabs.TabStatus" },
167+
"Tab.status": { "Ref": "Tabs.TabStatus" },
166168
"Port.onMessage": { "Ref": "Runtime.OnMessageEvent" }
167169
}
168170
}

src/WebExtensions.Net/Generated/Tabs/ChangeInfo.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ public partial class ChangeInfo : BaseObject
7171
/// <summary>The status of the tab. Can be either <em>loading</em> or <em>complete</em>.</summary>
7272
[JsAccessPath("status")]
7373
[JsonPropertyName("status")]
74-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
75-
public string Status { get; set; }
74+
public TabStatus Status { get; set; }
7675

7776
/// <summary>The title of the tab if it has changed. This property is only present if the extension's manifest includes the <c>"tabs"</c> permission.</summary>
7877
[JsAccessPath("title")]

src/WebExtensions.Net/Generated/Tabs/Tab.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ public partial class Tab : BaseObject
138138
/// <summary>Either <em>loading</em> or <em>complete</em>.</summary>
139139
[JsAccessPath("status")]
140140
[JsonPropertyName("status")]
141-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
142-
public string Status { get; set; }
141+
public TabStatus Status { get; set; }
143142

144143
/// <summary>The ID of this tab's successor, if any; $(ref:tabs.TAB_ID_NONE) otherwise.</summary>
145144
[JsAccessPath("successorTabId")]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
This file is auto generated at 2025-08-04T18:05:16
1+
This file is auto generated at 2025-08-13T19:58:56

test/WebExtensions.Net.BrowserExtensionIntegrationTest/Tests/TabsApiTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using WebExtensions.Net.BrowserExtensionIntegrationTest.Infrastructure;
2+
using WebExtensions.Net.Tabs;
23

34
namespace WebExtensions.Net.BrowserExtensionIntegrationTest.Tests
45
{
@@ -98,7 +99,7 @@ public async Task Get()
9899
// Act
99100
var tab = await webExtensionsApi.Tabs.Get(testTabId.Value);
100101
var attemptCount = 0;
101-
while (tab.Status != "complete" && attemptCount < 10)
102+
while (tab.Status != TabStatus.Complete && attemptCount < 10)
102103
{
103104
attemptCount++;
104105
await Task.Delay(500);
@@ -109,7 +110,7 @@ public async Task Get()
109110
tab.ShouldNotBeNull();
110111
tab.Id.ShouldBe(testTabId.Value);
111112
tab.Url.ShouldBe(testTabUrl);
112-
tab.Status.ShouldBe("complete");
113+
tab.Status.ShouldBe(TabStatus.Complete);
113114
}
114115

115116
[Fact(Order = 2)]
@@ -141,7 +142,7 @@ public async Task Update()
141142

142143
// Assert
143144
tab.ShouldNotBeNull();
144-
tab.Status.ShouldBe("loading");
145+
tab.Status.ShouldBe(TabStatus.Loading);
145146
}
146147

147148
[Fact(Order = 4)]

0 commit comments

Comments
 (0)