mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FIX: Restore class-property babel transform for themes (#19883)
This seems to be required for decorators to work on class properties. Followup to 624f4a7de92d8a464c91a334bf9fad510af7e4ef
This commit is contained in:
@ -41,13 +41,6 @@ RSpec.describe DiscourseJsProcessor do
|
||||
script = <<~JS.chomp
|
||||
optional?.chaining;
|
||||
const template = func`test`;
|
||||
class MyClass {
|
||||
classProperty = 1;
|
||||
#privateProperty = 1;
|
||||
#privateMethod() {
|
||||
console.log("hello world");
|
||||
}
|
||||
}
|
||||
let numericSeparator = 100_000_000;
|
||||
logicalAssignment ||= 2;
|
||||
nullishCoalescing ?? 'works';
|
||||
@ -76,6 +69,24 @@ RSpec.describe DiscourseJsProcessor do
|
||||
JS
|
||||
end
|
||||
|
||||
it "supports decorators and class properties without error" do
|
||||
script = <<~JS.chomp
|
||||
class MyClass {
|
||||
classProperty = 1;
|
||||
#privateProperty = 1;
|
||||
#privateMethod() {
|
||||
console.log("hello world");
|
||||
}
|
||||
@decorated
|
||||
myMethod(){
|
||||
}
|
||||
}
|
||||
JS
|
||||
|
||||
result = DiscourseJsProcessor.transpile(script, "blah", "blah/mymodule")
|
||||
expect(result).to include("_applyDecoratedDescriptor")
|
||||
end
|
||||
|
||||
it "correctly transpiles widget hbs" do
|
||||
result = DiscourseJsProcessor.transpile(<<~JS, "blah", "blah/mymodule")
|
||||
import hbs from "discourse/widgets/hbs-compiler";
|
||||
|
Reference in New Issue
Block a user