Feature Pack with bug fixes for V2

This commit is contained in:
Ujwal223
2026-06-13 13:06:25 +05:45
parent 39b6545e4a
commit b7c8120496
41 changed files with 453 additions and 414 deletions
@@ -5,20 +5,22 @@ import 'package:focusgram/scripts/focus_scripts.dart';
void main() {
group('FocusSettings — Field cleanup', () {
test('only ghostMode remains (fullDmGhost and storyGhost removed)',
() async {
const settings = FocusSettings(ghostMode: true);
test(
'only ghostMode remains (fullDmGhost and storyGhost removed)',
() async {
const settings = FocusSettings(ghostMode: true);
expect(settings.ghostMode, isTrue);
expect(settings.noAds, isTrue);
expect(settings.noStories, isFalse);
expect(settings.noReels, isFalse);
expect(settings.noAutoplay, isFalse);
expect(settings.noDMs, isFalse);
expect(settings.ghostMode, isTrue);
expect(settings.noAds, isTrue);
expect(settings.noStories, isFalse);
expect(settings.noReels, isFalse);
expect(settings.noAutoplay, isFalse);
expect(settings.noDMs, isFalse);
// Verify fullDmGhost and storyGhost are NOT fields anymore
// (these would be compile errors if they existed)
});
// Verify fullDmGhost and storyGhost are NOT fields anymore
// (these would be compile errors if they existed)
},
);
test('default ghostMode is false', () async {
const settings = FocusSettings();
@@ -43,8 +45,7 @@ void main() {
});
test('does NOT inject ghost scripts when ghostMode is false', () async {
final scripts =
buildUserScripts(const FocusSettings(ghostMode: false));
final scripts = buildUserScripts(const FocusSettings(ghostMode: false));
// Should have no start scripts (ghostMode is the only start-level script)
// unless other features like noAutoplay are also false
@@ -62,9 +63,9 @@ void main() {
);
// Should have 1 DOCUMENT_START script combining ghost + autoplay
final startScripts =
scripts.where((s) =>
s.injectionTime == UserScriptInjectionTime.AT_DOCUMENT_START);
final startScripts = scripts.where(
(s) => s.injectionTime == UserScriptInjectionTime.AT_DOCUMENT_START,
);
expect(startScripts.length, equals(1));
expect(startScripts.first.source, contains('__fgFullDmGhost=true'));
expect(startScripts.first.source, contains('document.addEventListener'));