WIP components (as built)
This commit is contained in:
80 files changed
+2754
-132
No files matched your search
@@ -28,7 +28,7 @@ func TestApiRequestBuilderBuildAndSend(t *testing.T) {
|
||||
_ = tt.Click("Send") // disabled without a URL
|
||||
_ = tt.Click("Request URL")
|
||||
tt.Type("ftp://court")
|
||||
if !tt.HasText("the URL needs http:// or https:// and a host") || sends != 0 {
|
||||
if !tt.HasText("Enter a valid HTTP or HTTPS URL") || sends != 0 {
|
||||
t.Fatalf("invalid URL: %q", tt.Texts())
|
||||
}
|
||||
req.URL = ""
|
||||
@@ -91,3 +91,34 @@ func TestApiRequestBuilderSnapshot(t *testing.T) {
|
||||
ui.Column(c).Padding(16).Children(func() { ApiRequestBuilder(c, &req, ApiRequestBuilderOptions{}) })
|
||||
})
|
||||
}
|
||||
|
||||
func TestApiRequestBuilderDisabledPreservesDefault(t *testing.T) {
|
||||
var req ApiRequest
|
||||
sends := 0
|
||||
ui.NewTester(func(c *ui.Context) {
|
||||
Use(c, Settings{})
|
||||
ui.Column(c).Disabled(true).Children(func() { ApiRequestBuilder(c, &req, ApiRequestBuilderOptions{}) })
|
||||
}, 600, 400)
|
||||
if req.Method != "" || sends != 0 {
|
||||
t.Fatal("disabled request changed")
|
||||
}
|
||||
}
|
||||
|
||||
func TestApiRequestBuilderAncestorDisabledTabs(t *testing.T) {
|
||||
disabled := false
|
||||
request := ApiRequest{URL: "https://court.example", Params: []KeyValue{{Key: "page", Value: "1", Enabled: true}}, Headers: []KeyValue{{Key: "Accept", Value: "application/json", Enabled: true}}}
|
||||
tt := ui.NewTester(func(c *ui.Context) {
|
||||
Use(c, Settings{})
|
||||
ui.Column(c).Disabled(disabled).Children(func() {
|
||||
ApiRequestBuilder(c, &request, ApiRequestBuilderOptions{})
|
||||
})
|
||||
}, 760, 520)
|
||||
if err := tt.Click("Params (1)"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
disabled = true
|
||||
tt.Key(0, ui.KeyRight)
|
||||
if !tt.HasText("page") || tt.HasText("Accept") {
|
||||
t.Fatal("disabled request switched tabs")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user