mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-05 04:36:07 +00:00
Merge remote-tracking branch 'origin/master' into v2-exp
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,10 @@ updates:
|
||||
commit-message:
|
||||
prefix: "chore"
|
||||
include: "scope"
|
||||
groups:
|
||||
all:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
@@ -26,6 +30,10 @@ updates:
|
||||
commit-message:
|
||||
prefix: "chore"
|
||||
include: "scope"
|
||||
groups:
|
||||
all:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/"
|
||||
@@ -39,3 +47,7 @@ updates:
|
||||
commit-message:
|
||||
prefix: "chore"
|
||||
include: "scope"
|
||||
groups:
|
||||
all:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
@@ -11,12 +11,12 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Download Go modules
|
||||
run: go mod download
|
||||
|
||||
@@ -12,12 +12,12 @@ jobs:
|
||||
GO111MODULE: "on"
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Coverage
|
||||
env:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020-2023 Charmbracelet, Inc
|
||||
Copyright (c) 2020-2025 Charmbracelet, Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -216,6 +216,6 @@ We’d love to hear your thoughts on this project. Feel free to drop us a note!
|
||||
|
||||
Part of [Charm](https://charm.sh).
|
||||
|
||||
<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a>
|
||||
<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-banner-next.jpg" width="400"></a>
|
||||
|
||||
Charm热爱开源 • Charm loves open source
|
||||
|
||||
@@ -5,6 +5,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
func Test_CurrentSuggestion(t *testing.T) {
|
||||
@@ -46,6 +48,30 @@ func Test_SlicingOutsideCap(t *testing.T) {
|
||||
textinput.View()
|
||||
}
|
||||
|
||||
func TestChinesePlaceholder(t *testing.T) {
|
||||
textinput := New()
|
||||
textinput.Placeholder = "输入消息..."
|
||||
textinput.Width = 20
|
||||
|
||||
got := textinput.View()
|
||||
expected := "> 输入消息... "
|
||||
if got != expected {
|
||||
t.Fatalf("expected %q but got %q", expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlaceholderTruncate(t *testing.T) {
|
||||
textinput := New()
|
||||
textinput.Placeholder = "A very long placeholder, or maybe not so much"
|
||||
textinput.Width = 10
|
||||
|
||||
got := textinput.View()
|
||||
expected := "> A very …"
|
||||
if got != expected {
|
||||
t.Fatalf("expected %q but got %q", expected, got)
|
||||
}
|
||||
}
|
||||
|
||||
func ExampleValidateFunc() {
|
||||
creditCardNumber := New()
|
||||
creditCardNumber.Placeholder = "4505 **** **** 1234"
|
||||
@@ -78,3 +104,15 @@ func ExampleValidateFunc() {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func keyPress(key rune) tea.Msg {
|
||||
return tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{key}, Alt: false}
|
||||
}
|
||||
|
||||
func sendString(m Model, str string) Model {
|
||||
for _, k := range str {
|
||||
m, _ = m.Update(keyPress(k))
|
||||
}
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user