Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions packages/core/lib/src/models/slide_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,35 +72,6 @@ class Slide with SlideMappable {

/// Validates [map] against the schema and constructs a [Slide].
static Slide parse(Map<String, Object?> map) => fromMap(schema.parse(map)!);

/// Creates an error slide to display errors in the presentation.
///
/// This slide is automatically generated when there are parsing errors
/// or other issues loading the presentation.
static Slide error({
required String title,
required String message,
required Exception error,
}) {
return Slide(
key: 'error',
sections: [
SectionBlock([
ContentBlock('''
> [!CAUTION]
> $title
> $message


```dart
${error.toString()}
```
'''),
ContentBlock(''),
]),
],
);
}
}

/// Configuration options for a slide.
Expand Down
47 changes: 0 additions & 47 deletions packages/core/test/src/models/slide_model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,53 +266,6 @@ void main() {
});
});

group('error factory', () {
test('creates error slide with correct key', () {
final slide = Slide.error(
title: 'Error Title',
message: 'Error message',
error: Exception('Test error'),
);

expect(slide.key, 'error');
});

test('includes title and message in content', () {
final slide = Slide.error(
title: 'Parse Error',
message: 'Could not parse slide',
error: Exception('Details'),
);

final content = (slide.sections[0].blocks[0] as ContentBlock).content;
expect(content.contains('Parse Error'), isTrue);
expect(content.contains('Could not parse slide'), isTrue);
});

test('includes error details in code block', () {
final slide = Slide.error(
title: 'Error',
message: 'Message',
error: Exception('Detailed error info'),
);

final content = (slide.sections[0].blocks[0] as ContentBlock).content;
expect(content.contains('Detailed error info'), isTrue);
expect(content.contains('```dart'), isTrue);
});

test('creates section with two content blocks', () {
final slide = Slide.error(
title: 'E',
message: 'M',
error: Exception('X'),
);

expect(slide.sections.length, 1);
expect(slide.sections[0].blocks.length, 2);
});
});

group('equality', () {
test('equal slides are equal', () {
final slide1 = Slide(key: 'same', comments: ['note']);
Expand Down
Loading