Skip to content

Commit de7da73

Browse files
committed
Add ProgressView tests
1 parent 4d3b9ab commit de7da73

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Sources/LiveViewNative/Views/Controls and Indicators/Indicators/ProgressView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct ProgressView<R: CustomRegistry>: View {
2020
if let timerIntervalStart = element.attributeValue(for: "timer-interval-start").flatMap({ try? ElixirDateParseStrategy().parse($0) }),
2121
let timerIntervalEnd = element.attributeValue(for: "timer-interval-end").flatMap({ try? ElixirDateParseStrategy().parse($0) })
2222
{
23+
// TODO: Note that this variant has a default `currentValueLabel`, which should be used if no current value label slot is used. It seems to only be active when initializing without the `currentValueLabel` argument.
2324
SwiftUI.ProgressView(
2425
timerInterval: timerIntervalStart...timerIntervalEnd,
2526
countsDown: element.attributeValue(for: "counts-down") != "false"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// ProgressViewTests.swift
3+
//
4+
//
5+
// Created by Carson Katri on 1/17/23.
6+
//
7+
8+
import XCTest
9+
import SwiftUI
10+
@testable import LiveViewNative
11+
12+
@MainActor
13+
final class ProgressViewTests: XCTestCase {
14+
func testValue() throws {
15+
try assertMatch(#"<progressview value="0.5" />"#) {
16+
ProgressView(value: 0.5)
17+
}
18+
}
19+
20+
func testTotal() throws {
21+
try assertMatch(#"<progressview value="2.5" total="5" />"#) {
22+
ProgressView(value: 0.5, total: 5)
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)