Skip to content
Open
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
14 changes: 13 additions & 1 deletion assets/js/lib/vue.min.js

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions tests/unit/VueBuild_Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

Check failure on line 1 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Missing file doc comment
use PHPUnit\Framework\TestCase;

final class VueBuild_Test extends TestCase {

Check failure on line 4 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Missing doc comment for class VueBuild_Test
public function test_vue_min_is_production_flags(): void {

Check failure on line 5 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Missing doc comment for function test_vue_min_is_production_flags()

Check failure on line 5 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Tabs must be used to indent lines; spaces are not allowed
$path = __DIR__ . '/../../assets/js/lib/vue.min.js';

Check failure on line 6 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Tabs must be used to indent lines; spaces are not allowed
$this->assertFileExists($path, 'vue.min.js does not exist');

Check failure on line 7 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Tabs must be used to indent lines; spaces are not allowed
$contents = file_get_contents($path);

Check warning on line 8 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.

Check failure on line 8 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Tabs must be used to indent lines; spaces are not allowed
$this->assertNotFalse($contents);

Check failure on line 9 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Tabs must be used to indent lines; spaces are not allowed
// Production build should set productionTip:false and devtools:false

Check failure on line 10 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Tabs must be used to indent lines; spaces are not allowed
$this->assertStringContainsString('productionTip:!1', $contents, 'Expected productionTip disabled in production build');

Check failure on line 11 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Tabs must be used to indent lines; spaces are not allowed
$this->assertStringContainsString('devtools:!1', $contents, 'Expected devtools disabled in production build');
}

public function test_vue_min_has_wu_vue_wrapper(): void {
$path = __DIR__ . '/../../assets/js/lib/vue.min.js';

Check warning on line 16 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
$contents = file_get_contents($path);

Check warning on line 17 in tests/unit/VueBuild_Test.php

View workflow job for this annotation

GitHub Actions / Code Quality Checks

file_get_contents() is discouraged. Use wp_remote_get() for remote URLs instead.
$this->assertNotFalse($contents);
$this->assertStringContainsString('window.wu_vue', $contents, 'Expected window.wu_vue wrapper present');
$this->assertMatchesRegularExpression('/defineComponent/', $contents, 'Expected defineComponent to be exposed via wrapper');
}
}
Loading